DataBind a GridView Immediately?

Jun 22 2008 8:11 AM
Hi all, I'm loading data into a DataTable and then binding it to my grid view. The thing is I want to then dynamically add a CheckBoxColumn which I'm doing by creating my own template class. That's all fine except for 2 things... 1. I want to add the new CheckBoxColumn to the end column of the grid. 2. I want to then scan the results of the grid and depending on the results, enable or disable each checkbox on the row. The problem is that it doesn't actually DataBind() until the page is rendered. That means that I can't scan the results or add to the end using GridView.Insert(GridView.Columns.Count-1, CheckBoxColumn) as there are no results in the Grid. Does anyone know a way around this pesky problem. I've already wasted my Saturday trying to find out! Thanks all. Rob

Answers (2)