E
enak
I populate a datagrid by setting the datasource to a
datatable. I then, bind them. After that I try to hide the
last column but am not able to. I get an error message.
Here is my code:
Me.dgReport.DataSource = ds.Tables("tFirst")
Me.dgReport.DataBind()
Me.dgReport.Columns(7).Visible = False
Here is the error that I get:
System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the size of the
collection. Parameter name: index
If I take the last line of code out then the page
displayes as expected except for the last column. I tried
to hide column 3 but got the same result.
After the Bind command I looked at the Columns.Count
property and it is 0. Why is this happening and how do I
fix it?
Thanks
enak
datatable. I then, bind them. After that I try to hide the
last column but am not able to. I get an error message.
Here is my code:
Me.dgReport.DataSource = ds.Tables("tFirst")
Me.dgReport.DataBind()
Me.dgReport.Columns(7).Visible = False
Here is the error that I get:
System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the size of the
collection. Parameter name: index
If I take the last line of code out then the page
displayes as expected except for the last column. I tried
to hide column 3 but got the same result.
After the Bind command I looked at the Columns.Count
property and it is 0. Why is this happening and how do I
fix it?
Thanks
enak