protected void DataGrid1_ItemCommand (object source, DataGridCommandEventArgs e)
{
DataRowView row = (DataRowView) e.Item.DataItem;
}
row represents the row of the DataView bound to that row.
e.Item.RowIndex
It is recommended to put hidden on this line. Then use findcontrol.
1. Add on the linkbutton template column
<input type = "hidden" id = "hidPK" runat = "server" value = '<% # Eval ("PKFieldName")%>'>
2. In the rowCommand event
HtmlInputHidden hidPk = e.Item.FindControl ("hidPK") as HtmlInputHidden;
dbaccess.Delete (hidPk.Value);