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
ram123ram123 

Visualforce View State Postback ?

Question about View State:

 

I assume there is View State exchange between client browser and visualforce in all cases even  if  there is no change in data in client side, if this case is true, any idea why this view state is posted back to client browser, even though there is no changed in data ? Its kind of similar to etag, but in case of etag, the server sends only no change message.

 

 

Thanks

Ram

 

Richie DRichie D

Hi Ram,

 

You are correct in the viewstate being passed back and forth between SFDC servers and the client browser. This is to allow SFDC to rebuild the controller and its related data/variables and maintain state between callbacks to the server. If this didn't happen each request would be treated as a new one and require SFDC to create new controllers whcih would then be in the incorrect state.  If you have for example a collection of items in your controller that you know isn't required after the inital page generation then mark this as transisent and it won't appear in the viewstate.

 

It's not just about the data changes being passed backwards and forwards; there's more to it than that! Try running your pages in developer mode with view viewstate enabled. Then you can navigate around and see whats in the viewstate.

 

Hope this helps.

Rich.

ram123ram123

Hi Rich,

 

90% of case is what you mentioned, vf controller/page reconstructed with view state. Incase of ajax request assuming view state didn't changed but the view state exchange still happens i guess, thats could have been handled as special case with no view state post back.

 

Thanks
Ram