+ Start a Discussion
yaramareddy radhikayaramareddy radhika 

What is View State in salesforce? and mention uses of view state?

Arvind KumarArvind Kumar
Hi Radhika,

View State: Visualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page - state that includes the components, field values and controller state.

1.) Minimize number of form on a page.  Use apex:actionRegion instead of using 2 or more forms.
2.) Refine your SOQL to only retrieve the data needed by the page.
3.) All public and private data members present in Standard, Custom and Controller extensions are saved.
4.) The transient variables are not passed to view state and therefore not stored in View State.

Read the below link for View State more information

1.) https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State
2.) http://www.salesforcetutorial.com/viewstate-salesforce/
3.) http://www.infallibletechie.com/2012/09/how-to-enable-view-state-in-salesforce.html
4.) http://www.jitendrazaa.com/blog/salesforce/introduction-to-view-state-in-visualforce/

If you have any query, let me know.

If it solves your problem mark as a best answer.

Arvind Kumar
Thanks, Nice information.