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
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 ]
Use transient keyword...
https://developer.salesforce.com/forums/ForumsMain?id=906F000000090eIIAQ
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
Check out the following links:
-
http://www.salesforce.com/us/developer/docs/pages/Content/pages_best_practices_performance.htm
-
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State
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.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 ]
thanks,
http://www.forcexplore.com/2014/08/visualforce-and-apex-tutorial-for-beginners.html
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.