Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > General Discussions > radgrid- edit row - Code behind

Not answered radgrid- edit row - Code behind

Feed from this thread
  • Manoj avatar

    Posted on Jun 3, 2012 (permalink)

    Hi,

    I need to edit radgrid row in the code behind.

    Please help me.

    Reply

  • Posted on Jun 4, 2012 (permalink)

    Hi Manoj,

    You can write the code to update the RadGrid in the UpdateCommand event. Please take a look into the following code snippet.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AutoGenerateEditColumn="true" onupdatecommand="RadGrid1_UpdateCommand">
       <MasterTableView>
          <columns>
             <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" ></telerik:GridBoundColumn>
             <telerik:GridBoundColumn UniqueName="EmployeeID" DataField="EmployeeID" HeaderText="EmployeeID"></telerik:GridBoundColumn>
          </Columns>
       </MasterTableView>
    </telerik:RadGrid>

    C#:
    protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
    {
          GridEditableItem editItem = (GridEditableItem)e.Item;
          string OrderId = (editItem["OrderID"].Controls[0] as TextBox).Text;
          string EmployeeID = (editItem["EmployeeID"].Controls[0] as TextBox).Text;
          // code to update in the values in DataBase  
    }

    Thanks,
    Shinu.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > General Discussions > radgrid- edit row - Code behind