People will probably explain your all aspects of it specific to ASP.NET, but I want to suggest more universal alternative agnostic to the server side; it can even work without any server side at all, when you simply want to restore some UI state or any data at all after, say, local reload or any other action which need restoration of your previous state.
This universal API is
Web storage
:
Web storage — Wikipedia, the free encyclopedia[
^],
Web Storage API — Web APIs | MDN[
^],
Window.sessionStorage — Web APIs | MDN[
^],
Window.localStorage — Web APIs | MDN[
^].
Apparently, for your purpose you have to prefer session storage, not local storage. Local storage would contaminate your local browser data, but even with local storage you can easily wipe it out.
Also, you may reasonably prefer keeping all the state record by just one key and save restore everything at once. It would be the best idea. To do so, you would need to serialize and deserialize all data. It can be easily done with JSON:
JSON — JavaScript | MDN[
^].
You can find a comprehensive sample of the whole technique in my article, in the Web storage section:
JavaScript Calculator, 7 Dynamic Strict Mode Switching and Web Storage[
^]
That's all.
—SA