How can I get the underlying DataItem from a GridView row that is in edit mode and the user clicks on "Update"?
I have an editable GridView. I've added a CustomValidator to the Edit view of one of the columns. When the user clicks on Update I run a server validate method and need to get the underlying DataItem of the row being edited so that I can get the primary key of the data item for use in the validation.
GridView1.Rows[GridView1.EditIndex].DataItem;
This does not work. I guess because the GridView isn't databinded on the update command?
GridView1.DataKeys[GridView1.EditIndex].Value;