I need to do something like the following:
- On the page, when a checkbox state is changed, do an jQuery AJAX call to the server to set the state of the checkbox.
- Refresh a jqGrid which will use this value (another AJAX call).
There is no post.
In ASP.Net, I would set the value in the viewstate and use it from there. However, viewstate is not valid in MVC.
Where can I store this value so it will be available on all subsequent calls to this page for this session?
Isn’t the box still checked? Just reuse the value from the client. If you’re replacing it when you get the result via AJAX, you should be setting the value in the model before the (AJAX) response is returned so it has the proper value on the client. If the box represents some sort of preference, chosen once then applicable across all pages, then store it in the session or in some persistence mechanism (cookie, SQL server DB, RavenDB), retrieving it from there as needed.