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

Primary key in update command

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 01 Aug 2012, 01:18 PM
Hi all,
      I need the primary key value in update command. Quick help will be appreciated.
thanks
Savyo

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Aug 2012, 01:23 PM
Hi,

Try following code to get the DataKeyValue in UpdateCommand event.

C#:
protected void rdgdr1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editItem = (GridEditableItem)e.Item;
    string Datakey = editItem.OwnerTableView.DataKeyValues[editItem.ItemIndex]["DataKeyName"].ToString();
}

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