Tuesday, August 09, 2005

Saving View State to a Place OTHER THAN a Hidden Field on the Page

If you want to keep the view state server-side or in some other place on the rendered page.
You might, for instance, determine that the wire cost exceeds the server-side memory cost and therefore want to keep View State on the server.

Override these two methods :


Saves any view-state information for the page.
Override this method if you want to save the Page view state in anything other than a hidden field. If you choose to do so, you must also override the Page.LoadPageStateFromPersistenceMedium method.

protected virtual void SavePageStateToPersistenceMedium(object viewState);



Loads any saved view-state information to the Page object. Override this method if you want to load the Page view-state information in anything other than a hidden field.

If you want to specify something other than hidden fields to save view state when using this method, you must also override the SaveStateToPersistenceMedium method.

protected virtual object LoadPageStateFromPersistenceMedium();

No comments:

C# Sucks!

JK!! Seriously, though, somewhere around C#-3 we should have inculcated ourselves with the question: "Does 'CAN' == 'SHOULD...