I'd like to be able to hide grid columns and then save the settings to a user profile. I can hide the columns on the client side just fine, but then on the next postback, the columns are back. Is it possible to persist the visible/hidden columns? I also would like this to be done without a postback.
Thanks,
Hello,
I think this is possible, however you will need to write some custom code for that. In the same javascript client side function that you use to hide the column of the grid just update a hidden field
<asp:hiddenfield runat="server" ID="ColumnState" />
document.getElementById("<%= ClientState.ClientID ").value += colIndex + ",";
The on the server, you can parse the string (split by ",") and get the list of columns to be hidden from the server side as well.
Hope this helps.
Yeah, I was hoping I didn't have to do that though. It seems this should be included in a future release because it does keep track of the column ordering just fine.
Thank you.
Yes, it is a good point, we do think on making something publicly exposed for that. You can also review this forum thread for additional ideas for saving / loading grid state (although a little different from your scenario which includes tracking client-side changes to the server) - this may provide additional ideas:
http://forums.infragistics.com/forums/p/9885/45543.aspx#45543
I will do my best to have this idea (auto track client side changes) promoted for future releases.
Yes it would be very nice if that feature of being able to save/load the grid state was a part of the grid.
Yep, I will try to escalated that. Just wanted to let you know, that we have a great customer feedback form, where you can suggest feature request (or even new products) directly to our Product Management team. The link is here:
http://devcenter.infragistics.com/Protected/RequestFeature.aspx
PM regularly scans all feature requests submitted via this form and chances are that this will be included at one point in subsequent releases. We take customer feedback very seriously, and from what I am seeing, most if not all of our TODO list is based on features requested by customer.
I forgot to mention I was using the Callback Feature to get the column number on server-side.
thx.
This could be a page lifecycle thing, I guess it really depends on where you are using your code. Chances are that the grid is bound at a later point (after calling your UltraWebGrid1.Columns[ColumnID].Hidden= true; line). Databinding the grid essentially clears all columns and rows from the grid and all visual settings and starts from scratch.
Is it possible to move the code to a place where you are sure happens after databinding? This could be the PreRenderComplete event for example.
Hi,
I have the same problem and can't fix this. First I hide a column on the client side:
then I hide the same column on the server side:
UltraWebGrid1.Columns[ColumnID].Hidden= true;
then I save the grid settings into the database.
But after a postback. I got the same look as before I start hide the column. So the column I hide is back visible. How can I prvent this