+ Start a Discussion
Sree SalesforceSree Salesforce 

if i reach limit viewstate size 135kb .then how i can i solve that issue in visualforce

Kathir DevanKathir Devan

Use transient keyword...
Kathir DevanKathir Devan
Please go through url:


If your viewstate has reach near to 135 kb than you have to show limiited data to user and if some data which you want show only on page and don't need to get back from page then use Transient Keyword before that property.

If you are showing data in table then you have to use pagination.

IF it helps you than please mark it as a solution and ENJOY APEX
James LoghryJames Loghry
Salesforce has some decent documentation on this already.

Check out the following links:
The gist is, using "Development Mode" you can view your view state size and do some debugging.  Additionally, you have to be careful about what you're storing in your controller.  Kathir is correct that using the transient word can help, but only when you don't need to pass a variable around in forms, per se.  Read the documents above and you should have a better understanding of how to address your view state issue.

1.make sure you clear unused collections. Clear when they are no longer required.
2. Query limited fields [Only which are required]
3. Use transient keywords
4. If you have a query that returns large number of records then put a limit varible on it. Vary limit integer and see at what point it breaks. In such situations it is Better to have a configurable item bound against the limit variable [ex, custom setting ]

First find out if you can use "transient" keyword.

Remove all unused variable which are not required on page.

Query fileds which are required.

If you are using attachment then make sure there is no "body" field. Quering this filed must be avoided.

Also, enable view state in development mode and find out culprits.