H
headware
I'm trying to create a DataGrid filled with values from a DataSet and
I want the user to be able to show and hide whichever columns they
choose. I have a dropdown list box filled with the column names so the
user can select a column name and hit a button to hide or show it.
I originally tried to use an unbound DataGrid with autogenerated
columns, however the DataGrid.Columns collection is empty when all the
columns are autogenerated (which seems unnecessarily unfriendly to me,
but that's beside the point). As a result the table displayed the
correct data but I had no way to access the columns in order to hide
them.
So I tried to set up explicitly bound columns. I changed the
"autogenerate columns" property to false and specified the same amount
of columns in the DataGrid as the DataSet was returning. Now, I have
the opposite functionality. I can get the columns to show and hide but
the data isn't showing up in the grid. It has no rows. What's going on
here? Is there any better way to do this? It's driving me nuts.
Thanks
I want the user to be able to show and hide whichever columns they
choose. I have a dropdown list box filled with the column names so the
user can select a column name and hit a button to hide or show it.
I originally tried to use an unbound DataGrid with autogenerated
columns, however the DataGrid.Columns collection is empty when all the
columns are autogenerated (which seems unnecessarily unfriendly to me,
but that's beside the point). As a result the table displayed the
correct data but I had no way to access the columns in order to hide
them.
So I tried to set up explicitly bound columns. I changed the
"autogenerate columns" property to false and specified the same amount
of columns in the DataGrid as the DataSet was returning. Now, I have
the opposite functionality. I can get the columns to show and hide but
the data isn't showing up in the grid. It has no rows. What's going on
here? Is there any better way to do this? It's driving me nuts.
Thanks