Getting Cell Text from a hidden GridView Column

Please follow and share!
Twitter
Facebook
LinkedIn
RSS
I hit an issue today while working with the GridView control. I have a column that contains the Wilco RowSelectorField checkbox control, and I needed to collect each checked grid view row upon a button-click event.  The problem was that the primary key id value of the row that I needed to perform a database operation was in a hidden column and trying to obtain the cell text of that column always returned an empty string. 
 
Having always used the Infragistics UltraWebGrid control in the past, I had never had this problem before.  As it turns out, if you set the visibility of the column itself to false, trying to obtain the cell text from that column will always return an empty string.  What you need to do is on the GridView’s OnItemDataBound event, set the visibility of each cell individually to false, then it will work like a charm!
 
e.Row.Cells[0].Visible=false;
Please follow and share!
Twitter
Facebook
LinkedIn
RSS