Best way to get row data in a DataGrid delete handler

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top