ViewStateManager

Provides a system service for maintaining state across views (to address the "back button" issue).

Remarks

ViewStateManager provides support for saving and restoring viewstate across pages - e.g. to cause a CardDeck control to show the correct card when the user navigates back to a page using their back button.

Viewstate should be minimal in size, as it will be saved in the hash section of the current URL. It should not include data retrieved from the server. Most controls will never use the ViewStateManager directly - instead, they will use Control.setViewState() and Control.getViewState().

Methods

getViewState Called by a view to retrieve viewstate it has previously saved.
load Called internally by the framework at load time. Load any viewstate that was previously saved from the location url. The viewstates will be in the form id1-viewStateValue1!id2-viewStateValue2!...
removeViewState A view that has saved its state, but is being unsited, should prune its viewstate from the viewstate manager. Use Control.getViewStateId to generate the viewId.
setViewState Called by a view when it wishes to save viewstate.

ViewStateManager getViewState method

Called by a view to retrieve viewstate it has previously saved.

JavaScript

viewStateManager.getViewState(viewId)

Remarks

Use the same viewId as in the previous call to save view state. Use Control.getViewStateId() to generate this.

ViewStateManager load method

Called internally by the framework at load time. Load any viewstate that was previously saved from the location url. The viewstates will be in the form id1-viewStateValue1!id2-viewStateValue2!...

JavaScript

viewStateManager.load()

ViewStateManager removeViewState method

A view that has saved its state, but is being unsited, should prune its viewstate from the viewstate manager. Use Control.getViewStateId to generate the viewId.

JavaScript

viewStateManager.removeViewState(viewId)

ViewStateManager setViewState method

Called by a view when it wishes to save viewstate.

JavaScript

viewStateManager.setViewState(id,newState)

Remarks

The id is a string that uniquely and consistently describes the owner of the view state. Use Control.getViewStateId() to generate this.

The newState must be a string.