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.
Hi,
I have similar problem.
To resolve this I have created a java script function as followed.
grid.Bands[0].getColumnFromKey(colName).setHidden(true); //This line is giving error.
}
I am calling this method in InitializeLayout event handler in javascript as follows.
Please Note:
1. I am using DemandOnLoad=Xml
4. This works fine when I am binding data first time. But Error occurs when I select another data source from list and click on button.
5. Grid also have filters.
Can you please provide any work around for this or guide me for-
1. This works fine when i am binding data first time. I am binding the grid in button load event at server side.