Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai...
I'm Using Telerik RadGrid control with SQLDataSource...I uses the following code..
ASP.NET
<telerik:RadGrid ID="RadGrid_Team"  runat="server" Skin="Simple"
        CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="Vertical"  
         AllowAutomaticUpdates="True" AllowAutomaticDeletes="true">
<MasterTableView AutoGenerateColumns="False" EditMode="InPlace" DataKeyNames="tid" 
            DataSourceID="SqlDataSource4" CellPadding="0">
<CommandItemSettings ExportToPdfText="Export to PDF"/>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
    <Columns>
    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" UpdateText="Save" />
        <telerik:GridNumericColumn DataField="tid" DataType="System.Int32" 
            FilterControlAltText="Filter tid column" HeaderText="tid" HeaderStyle-Font-Bold="true" ReadOnly="True" 
            SortExpression="tid" UniqueName="tid" Visible="false">
        </telerik:GridNumericColumn>
        <telerik:GridNumericColumn DataField="team" 
            FilterControlAltText="Filter team column" HeaderText="Team#" HeaderStyle-Font-Bold="true"
            SortExpression="team" UniqueName="team" ReadOnly="true">
        </telerik:GridNumericColumn>
        <telerik:GridBoundColumn DataField="name" DataType="System.String"
            FilterControlAltText="Filter name column" HeaderText="Team Name" HeaderStyle-Font-Bold="true"
            SortExpression="name" UniqueName="name" ColumnEditorID="edittxt_teamname" >
        </telerik:GridBoundColumn>
       <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
       </telerik:GridButtonColumn>
    </Columns>
 <EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>
  <telerik:GridTextBoxColumnEditor ID="edittxt_teamname"  runat="server">
  <TextBoxStyle Width="85" />
</telerik:GridTextBoxColumnEditor>

    <asp:SqlDataSource runat="server" ID="SqlDataSource1"  ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT tid,team,name from table1"
        DeleteCommand="delete from table1 where tid=@tid"
        UpdateCommand="update table1 set name=@name where tid=@tid ">
        <UpdateParameters>
        <asp:Parameter Name="name" Type="String"/>
        <asp:Parameter Name="tid" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>


The Delete is working put the Update is not working... I click Edit button then enter the text after i click save button it is pass the old value only..What is the problem please any one help me...

Thank's Lot...
Posted
Updated 30-Jan-12 18:14pm
v2

1 solution

Hi,

I had the same kind of problem.

Try to put the AllowAutomaticUpdates="True" (and all the others AllowAutomatic) in the MasterTableView tag.

ASP.NET
<telerik:RadGrid ID="YourGrid"  runat="server" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0" DataSourceID="YourEDSDataSource" GridLines="None" >
<ClientSettings>
<Selecting CellSelectionMode="None"></Selecting>
</ClientSettings>

<MasterTableView AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="YourEDSDataSource" EditMode="InPlace" AllowAutomaticUpdates="true" AllowAutomaticInserts="true" AllowAutomaticDeletes="true">
(...)


Hope it helps,

Regards

Raph
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900