Friday, July 03, 2009

fetch the record primary key from MasterTable while using FormTemplate for insert and update

when you have a FormTemplate for insert and update in RadGrid.MasterTable, there is no commangArgument, therefore the record's primary key can not be passed on using commandargument.


This can be done by

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Update")
{
int RecordId= Convert.ToInt32(RadGrid1.MasterTableView.DataKeyValues[e.Item.ItemIndex]["RecordId"].ToString());
}
}

No comments: