This is a migrated thread and some comments may be shown as answers.

UpdateCommand and DeleteCommand

1 Answer 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 04 Dec 2012, 12:58 PM
Hi,

How to implement the updatecommand and deletecommand code for RAD Grid.? Is there any code samples

I have added the below code in updatecommand:
GridEditableItem editedItem = e.Item as GridEditableItem;
            DataTable ordersTable = this.GridData;
  
            //Locate the changed row in the DataSource
            DataRow[] changedRows = ordersTable.Select("Title = " + Convert.ToString(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Title"]));

In the changedRows line, i am getting error as: Cannot perform '=' operation on System.String and System.Int32.

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Dec 2012, 04:20 AM
Hi,

You can access the datakeyvalue in UpdateCommand as shown below.
C#:
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
{
 GridEditableItem editedItem = (GridEditableItem)e.Item;
 string value= editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Title"].ToString();
}
Also check the following demo.
Grid / LinqToSql Manual Operations

Thanks,
Shinu.
Tags
Grid
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or