What is viewState?
ViewState holds state of the visualforce page that holds state that includes the fields, components and controller state. Viewstate data in encrypted and cannot be viewed tools like firebug.
To maintain state in a Visualforce page, the Force.com platform includes the state of components, field values, and controller state in a hidden form element. This encrypted string is referred to as the view state and has a limit of 135KB.
The data in the viewstate should be sufficient to recreate the state of the visualforce page when the postback is received. To do this, viewstate stores:
– Stores Non transient data members in the associated controller (standard\custom) and controller extensions.
– Stores Objects that are reachable from a non-transient data member in a controller or extension.
– Stores the component tree for that page, that tree represents the visualforce page’s component structure and the associated state, which are the values applied to those components.
– view state stores small amount of data.
How to see view state:
You can see view state when developer mode is enabled. See below screen.