I'm dynamically binding a WebDataGrid in C#. The grid can contain any value of columns based upon user selection. I have a specific column being returned which I need to hide from the user.
When creating a grid with known columns...I define the column and hide it in the designer - which works great.
In this scenerio I'll be binding to a data source in code and once binded I want to find the specific column I'm looking for and hide it.
How do I access a column after I bind dynamically and set the Hidden property to true?
Thank You!
Hello Jbristow,
both should be working:WebDataGrid1.Rows[0].Items[0].Column.Hidden = true;
or
WebDataGrid1.Columns[0].Hidden = true;
Hope this helps
The first example is what we discovered works.
What we think is happening is that on a dynamic data binding the column count for the grid is zero. When we tried the second example of accessing the column by index we got an error since the column collection appears to be empty on dynamic binding. BUT...when we accessed the column using the first example - going through the items collection - we were successful in hiding that column associated with the item.
A little quirky...but we got it to work.
Thanks.
If columns are autogenerated you can access them only on the client. For more detail information please check out this forum thread: http://forums.infragistics.com/forums/p/24191/242761.aspx#242761