Is there a way to hide columns in server side using AutoGenerateColumns as True?
If I use a BoundDataField for the columns I want to hide and those columns are shown twice and when I set the property Hide to True I got the following error:
Even when I hide a column with js I got the same error.
What can I do?
For anyone still looking, it appears Infragistics has limited their WebDataGrid now. (Which is sort of ridiculous. The whole reason I used Infragistics to begin with is that it WASN'T the MS GridView, so why on earth would you make it the same??) You can't modify autogenerated columns, according to Alex Kartavov of Infragistics ASP.NET/jQuery Team. Link is below, but here's his answer to the question:
Just like in the GridView, the Columns collection contains only the column objects that were added by hand in either aspx or in the code behind.The autogenerated columns are for the display purpose only, they cannot be accessed or modified.
https://es.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/30442/webdatagrid-columns-collection-is-empty-when-autogeneratecoumns-true
I'm having the same issue. Any new thoughts? I tried hiding the column on PreRender as well, and the column count is still zero at that point.
Any response on this yet?
I am also trying to do this but get the same issue.
Petar -
No such luck. When attempting to manipulate the Columns collection immediately after .DataBind(), it is still empty (.Count =- 0) when AutoGenerateColumns = True.
It would be extremely helpful to be able to hide a column based on its name while still allowing the Grid to generate the columns for me based on the data provided.
Can you suggest anything else?
Hi pelayito,
You should be able to hide columns in your code-behind, for instance in your Page_Load method:
[code]WebDataGrid1.Columns.FromKey("ID").Hidden = true;[/code]
Note that the grid should be dataBound prior to hiding columns when using auto column generation.
Please contact me if you have any questions.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.https://es.infragistics.com/support