wolfmanyoda
09-18-2006, 07:44 PM
This has me totally stumped.
I have a dataset that fills a gridview with autogenerated columns(that may be the problem).
I set the DataSource to my dataset and then DataBind it.
The SQL query only asks for 3 fields from the table but when I run the web page it creates columns for all 12 of the fields from the table, but only has data for the 3 that I asked for.
I figured I could just hide the unwanted columns by setting their visible property to false like so:
Me.grdObjectList.Columns(1).Visible = False
Me.grdObjectList.Columns(4).Visible = False
Me.grdObjectList.Columns(5).Visible = False
etc...
But this has no effect.
Actually when I set a breakpoint to my Catch block it throws an error saying that .Columns(1) is out of range.
I don't get that because there are 12 visible columns, so how can an index of 1 be out of range?
I think it may be the autogenerated columns, this is my first ASP app so I'm a little bit out of my comfort zone.
Any suggestions would be greatly appreciated.
I have a dataset that fills a gridview with autogenerated columns(that may be the problem).
I set the DataSource to my dataset and then DataBind it.
The SQL query only asks for 3 fields from the table but when I run the web page it creates columns for all 12 of the fields from the table, but only has data for the 3 that I asked for.
I figured I could just hide the unwanted columns by setting their visible property to false like so:
Me.grdObjectList.Columns(1).Visible = False
Me.grdObjectList.Columns(4).Visible = False
Me.grdObjectList.Columns(5).Visible = False
etc...
But this has no effect.
Actually when I set a breakpoint to my Catch block it throws an error saying that .Columns(1) is out of range.
I don't get that because there are 12 visible columns, so how can an index of 1 be out of range?
I think it may be the autogenerated columns, this is my first ASP app so I'm a little bit out of my comfort zone.
Any suggestions would be greatly appreciated.