Victor Charles
asked on
Help with making column in GridView invisible
Hello,
When I use the code below to set column(1) of my GridView to invisible, I receive the following error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Code:
Dim ds As New DataSet
ds.ReadXml(Server.MapPath( "~/App_Dat a/Country. xml"))
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
GridView1.Columns(1).Visib le = False
How do I fix this problem?
Thanks,
When I use the code below to set column(1) of my GridView to invisible, I receive the following error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Code:
Dim ds As New DataSet
ds.ReadXml(Server.MapPath(
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
GridView1.Columns(1).Visib
How do I fix this problem?
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
The code works but I need to achieve this by code. I have one grid displaying data from several xml files, the column I need to hide will depend on which xml file is being displayed.
Thanks,
Victor
The code works but I need to achieve this by code. I have one grid displaying data from several xml files, the column I need to hide will depend on which xml file is being displayed.
Thanks,
Victor
ASKER
Never mind my last post, I will add if statements for different xml files being loaded in the code to hide different columns.
Thanks,
Victor
Thanks,
Victor
ASKER
Thank You!
U can check it with
Gridview1.Columns.Count
Count might have only one.