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

Problem updating data

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 15 May 2012, 02:13 PM
Hello there..
I want somebody to help me find a solution to a problem regarding data updating. I have set the datakeyname in the aspx. However i need the primary key for updating data in the item command event.  How can i retrieve the primary key value in the itemcommand event.
Thanks in advance..

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 May 2012, 02:40 PM
Hi Savyo,

Please try the following code snippet.

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.UpdateCommandName)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        string DatakeyName = (e.Item).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UniqueName"].ToString(); 
    }
}

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