Best way to get row data in a DataGrid delete handler

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I'm trying to retrieve some data out of a row when a user clicks the delete
button in a row.

Here is my handler as found in examples:
protected void DataGrid1_Delete(Object sender, DataGridCommandEventArgs e)
{
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
....
}

However in my case the e.Item.ItemIndex is not valid. Is this because I'm
not using data row selection?
If so what other ways do I have to get to the row data of the delete button
row?
 
Back
Top