Hi ,
You could set you DataKeyNames like this in your gridview markup:
<asp:GridView .... DataKeyNames="ItemID" ...>
Then you could get the value in code behind like:
YourGridView.DataKeys[RowIndex].Values[0].ToString();
For more details ,also refer to links below:
Best Regards,
Nan Yu