function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VSK98VSK98 

Getting View State error

Hi All,

Intaially i got Collection size is exceed error, so i used readonly = true
Then i got View state error in my vf page ............
Total records are 1100 Now............

Adv Thnx
Siv
 
John PipkinJohn Pipkin
Siva, 

If your collection size is running into limits, you will need to implement pagination. See http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/
jyothsna reddy 5jyothsna reddy 5
Hi Siva Kumar,

    Visualforce is not designed to display more than 1000 records on the same page. Generally speaking, if your SOQL's are returning more than 1000 records and you attempt to display these records on a VF page, you will receive this error.

You can implement two solutions for this issue:

1- You can either limit the number of records you are trying to display to be less than 1000 or use pagination to display the records in different pages

2- You can use the @ReadOnly annotation on the method that retrieves the records or on the entire visualforce page. You can find more information about this here. 
View state Error:
Salesforce allows Visualforce pages to have a maximum view state size of 135KB.

The View State tab shows you which elements on your page are taking up that space.

A smaller view state size generally means quicker load times.

In order to avoid this error, minimize your pages' view state. You can optimize your Apex controller code and remove any superfluous Visualforce components used.

For better understand please follow the below link
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State

Regards,
Jyothsna D



 
VSK98VSK98
Hi John,

I have already implemented pagenation ,

i have two users, if one user logins the page, its nt throwing error because he's having 500 records
When the other user logins , error throws here.bcz he has more than 100 records