How can I save variables in asp.net between postback?
I’m using HttpContext.Current.Items but it always disposes after postback is there any other option to do that?
How can I save variables in asp.net between postback? I’m using HttpContext.Current.Items but it
Share
ViewState collection is mean for this purpose, in above example YourVariable is a variable whoes value you want to save and 123 is value of this variable.
ViewState is accessible within the scope of page. If you want to have values between different pages you can use sessions like ViewState[“YourVariable”] = “123”;