How to get a column value in DeleteCommand of RadGrid event
How can I get the value of a specific column in a RadGrid on DeleteCommand event? I tried these ways, but they all return empty values:
GridDataItem da = e.Item as GridDataItem;
string name = da["materialName"].Text;
or
name = RadGrid1.Items[e.Item.ItemIndex]["materialName"].Text;
or
name = RadGrid1.MasterTableView.Items[e.Item.开发者_JAVA技巧ItemIndex]["materialName"].Text;
or
name = RadGrid1.MasterTableView.Items[e.Item.RowIndex]["materialName"].Text;
Label colTxt = (Label)e.Item.Cells[3].Text;
Label1.Text = colTxt.Text;
Try this. It worked for me.
say the column is 'ID'
GridDataItem item = (GridDataItem)e.Item;
ID = Convert.ToInt32(item.GetDataKeyValue("ID"));
精彩评论