Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 07, 2013 02:28 PM by anandsrivastav1087
Feb 23, 2013 08:28 AM|LINK
my interviewer ask me to viewsate is server side or client side state management.i said client side.but he ask me viewstate can be set and access in server code ie .cs page. then how can you say that viewstate is client sid.Pls tell me the actual reason
Feb 23, 2013 08:35 AM|LINK
Viewstate is used to manage the state of controls so you can have access to them server side.
Feb 23, 2013 08:41 AM|LINK
so viewstate is access in server side , how ca i say it is aclient side statemenagement?
Feb 23, 2013 08:56 AM|LINK
Well it persists the state of controls client side for access on the server.
Feb 23, 2013 09:02 AM|LINK
i have a doubt.
see the exaample
viewstae["id"]=1; set value in page load
and save it to db in button click.
here no controls are used to store viewsate.the how can it say client side?
Mar 01, 2013 02:14 AM|LINK
I wouldn't say it is serverside nor client side, because the viewstate is carried out between postbacks, you can get the viewstate data both from the server and the client, so I would say it is control state manager, it isn't neither client explicit nor
server explicit. so client side means that the info is stored in the client machine, server side information stored in the server, very simple to understand :)
Mar 01, 2013 02:24 AM|LINK
I would like to add that the reason behind the viewstate is that usually the pages couldn't remember the state of the objects between postbacks, which simply means you have a form that has a dropdown with the property set to generate an autopostback after
the selected index is changed, what would happen before was that all of the other controls after the post back would be reset and the information the user filled out would be lost, so now since the objects have a viewstate that information is remembered between
postbacks, it actually happens by itself and you don't need to mess with it unless neccessary.
I hope this clarifies everything for you.
Mar 07, 2013 02:28 PM|LINK
we can manage server side but only can store client side one time if it set client side we can't clear server side