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?
Hello,if you are using BoundDataField for the columns, you should set AutoGenerateColumns to false. That's why your columns are shown twice.I believe you are getting the error because you're using <%= %>. Try using <%# %>.Regards,Nikolai Dimitrov
Hello Nikolai I still having this issue
I have AutoGenerateColumns set to true and I need it this way one of the columns is an Id and I don't want the user to see this info but I need it to identify each row to update date by this Id or some other things
So I haven't found a way to hide this columns if AutoGenerateColumns is false
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
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?
Any response on this yet?
I am also trying to do this but get the same issue.
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.
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