How do I extract data (besides the key-id) from a row that I'm deleting? I want to do this from within the method that handles the 'Telerik.Web.UI.RadGrid.DeleteCommandName' event. In that method, I have available a 'Telerik.Web.UI.GridCommandEventArgs' object (e) from which I can extract the ID of the item to be deleted:
GridEditableItem item = e.Item as GridEditableItem;
string recordID = (item.OwnerTableView.DataKeyValues[item.ItemIndex]["RecordID"]).ToString();
But I want to get other data, like the "Description" field or "Address" field.
I tried the following (which did not work):
GridDataItem dataItem = e.Item as GridDataItem;
string address = (dataItem != null ? dataItem["Address"].Text : "No information about the address.");
I get an exception telling me that it "cannot find a cell bound to the column name 'Address'". But I know the column-and-name is there.
I tried using the unique name of the column (by the way, this is a template column):
GridDataItem dataItem = e.Item as GridDataItem;
string address = (dataItem != null ? dataItem["AddressColumn"].Text : "No information about the address.");
But this just returned an empty string.
How do I proceed?
Thanks in advance.