Saturday, September 8, 2007

GridView accessing Columns Issue

GridView Columns seems to be hopeless when u do DataBound
When u bind the DataSource the only way to access GridView is thru its row only
Also I don’t like the way Cells are behaving in Row
I cannot give ColumnName in the cell
i.e., e.Row.Cells["AssignedAdm"] will not work
u even don’t have the facility to lookup the cell’s header like
e.Rows.Cells[0].Caption or e.Rows.Cells[0].HeaderText
The only way to get around the problem is remembering the cell index. The other way out is to get the GridView’s 1st row and get the Cell.Text which is the header and remember the index.

No comments: