Gridview code done.... now where do i place it
Posted on 2006-11-09
What i have done is created a search page that after going through and entering all the criteria it makes it the select command for the datasource (ex: sqldatasource.selectcommand = "Select...from...where...")
My gridview1 then uses this to populate the gridview. I now need it to make the id column invisible while also centering all of the infomation. I am pretty sure that this coding is correct.
The problem is when i test it the value for gridview1.columns.count = 2 when i know there are more columns. so the big question is where do i place this code to return the correct column count?
For i = 0 To GridView1.Columns.Count - 1
If GridView1.Columns(i).HeaderText = "id" Then
GridView1.Columns(i).Visible = False
GridView1.Columns(i).ItemStyle.HorizontalAlign = HorizontalAlign.Center