We all know that controls like TextBoxes keep their values when you submit a form, but how do you achieve the same with variables you have created in the Page Class?
Is this possible or do I have to put them in hidden textboxes??!!
Persisting those over postback is costly no matter which way you decide to do it:
ViewState offers a more scalable solution. The values are sent back and forth between the client and server in the viewstate hidden variable. Network traffic is your concern here. (this is how your textboxes are persisted, by the way)
Session offers a somewhat less scalable solution. The values are placed into server memory. The more in there, the slower the server runs. Server resources are your concern here.
Viewstate or some other form of serialization of the values is your best solution in nearly all cases.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.