Reputation: 175
Pardon my silly question, but can you store a value in a view state variable, and have it still available when navigating from one page to the next? I"m trying to replace session variables with view state variables
Upvotes: 0
Views: 52
Reputation: 139
According to ASP.Net, The code -> ViewState["VariableName"] = theData; can be used only within a Page. It wouldn't work in the next Page; as like Session Variables. One can use ViewState to keep a Value that can be used within a Page irrespective of the Multiple Events based on the Page.
If the requirement is to keep a Variable in one and that might be required in other Pages, than using Session Variables are Recommended.
Upvotes: 1