When i set EnableViewState to false, grouping and the ability to move columns don't seem to work. Is that to be expected or am i doing something wrong?
If it is to be expected then, is there a way to turn ViewState off and still keep the grouping and column moving functionality?
Any help will be appreciated, Thanks
Hawi
Hello Hawi,
Thanks for writing. Yes, I believe this is the expected behaviour - after postback the grid will not be able to "remember" its state if ViewState is disabled. This is due to the stateless nature of HTTP, the ViewState is simply a "hack" around it to deal with these types of situations.
While I do not recommend switching ViewState off completely, I can suggest one technique that will move the storage medium for ViewState from the HTML (in hidden) to the Server. This way, the page you serve to your clients will be much smaller, yet you will be able to have all the benefits ViewState has.
Here is a great blog post by Scott Hansleman on this topic
http://www.hanselman.com/blog/MovingViewStateToTheSessionObjectAndMoreWrongheadedness.aspx
Hope this helps.
Thanks for the response Rumen.
I just read the blog, all i get is is sarcasm from that blog. I'm not sure i understand what he is recommending.
Do you have any suggestions?
Oh, sorry for that, maybe it is not written well - sorry for that. There are a lot of examples for that other than this blog post, since this appears to be a widespread problem - maybe this one is better written:
http://www.codeproject.com/KB/viewstate/ServerViewState.aspx
I personally would not recommend anything specific, since it really depends on your scenario. If you decide to store ViewState on server, as opposed to have it embedded in the HTML page, you will have positives - reduced HTML size, and negative - a little bit increased load on the server.
It is really a matter of trade-offs and I guess, it really depends on your requirements which way you would prefer.
Thanks for your help.
I found the information i need from the following url
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1070