Once a column's Visible property is set to Hidden, no longer can we access it, since it returns blank.
To overcome that we can do 4 things
1) Use DATAKEY property and to hidden column ID.
GridView.DataKeys[0].Value.ToString();
2) Use TEMPLATE COLUMN and make it visible and access the values using FindControl.
Label lblID = (Label) GridView.Rows[0].FindControl("lblMyId");
3) Using a sylesheet ,set the property display=none, and can get the values.
GridView.Rows[0].Cell[0].Text
4) After databinding, set the visible property of the column.
GridView.Columns[0].Visible = false;
http://www.dotnetspark.com/kb/1937-how-to-get-hidden-column-value-gridview.aspx
To overcome that we can do 4 things
1) Use DATAKEY property and to hidden column ID.
GridView.DataKeys[0].Value.ToString();
2) Use TEMPLATE COLUMN and make it visible and access the values using FindControl.
Label lblID = (Label) GridView.Rows[0].FindControl("lblMyId");
3) Using a sylesheet ,set the property display=none, and can get the values.
GridView.Rows[0].Cell[0].Text
4) After databinding, set the visible property of the column.
GridView.Columns[0].Visible = false;
http://www.dotnetspark.com/kb/1937-how-to-get-hidden-column-value-gridview.aspx