Page Adapters and View State

When saving view state, the page generates a string that represents the portion of view state that is sent to the client. This string is encoded. It includes private view state (if any), and an identifier for any application view state saved in the session. With ASP.NET mobile controls, the page adapter must persist this string to the client and ensure that it is available on a subsequent postback.

On rendering, the page adapter must access the string through the page's ClientViewState property and write it to the client. On postback, the page adapter ensures that the persisted state is available in the form data by using the key defined by the ViewStateID static member of the MobilePage object (a string constant that is defined as "__VIEWSTATE").


Typically, you can have a page adapter write this string as a hidden form field whose name is specified by the ViewStateID field. When the form is submitted for postback, the value is automatically available in the form data, and the page adapter does not need to do any additional postback processing.