In the beta releases of ASP .Net 2.0, one could simply set the Visible attribute to False on a BoundField column in a GridView control, and then retrieve the value of the BoundField’s selected row by accessing the SelectedValue attribute of the GridView like so (maybe in the SelectedIndexChanged event):

string SelectedRowValue = GridView1.SelectedRow.Cells[0].Text;

But, in the final release you cannot do this, for security reasons. The previous code will just return an empty string. Now what should be done to get the value, is to not include the BoundField column you do not want to display at all. Instead, you should include the column name in the DataKeyNames attribute of the GridView. Then in the event you can retrieve the value like so:

string SelectedRowValue = GridView1.DataKeys[GridView1.SelectedIndex].Value;