开发者

Restoring page results in ASP.NET MVC

I am working in ASP.NET 3.5 MVC application. We have a functionality where we search for say "Customer search results", using some parameters.

If the user enter some search parameters like say, Date of birth/SSN/address, and hits search, the search results are displayed in a grid below. One of the records in the results can be clicked and it navigates to the customer information page. And from that page you can click on "Return to Search results" to come back to the search results page again, which can potentially show up the search parameters and the results of the last search.

We use sql server session state. And I am using the viewmodel and model binder to store the search parameters and results. So when the user comes from Customer information page back to search results page I am using the data stored in my model binder to bind the search results back.

However say the user is in customer information page and by the time the session开发者_运维技巧 expires, and when user tries to return back to search results page, the search parameters and search results are lost.

I should be able to pull the search parameters from SOMEWHERE where it can be restored(the store should not be a SESSION) when the information is lost. What I was trying is to store the parameters in the SQL table and pull it back when the data in my session is lost.

I don't necessarily worry about the search results as I may need to call a service to pull the results, but only care about the way to retrieve the search parameters when its lost due to session expiry.

May I know if there is any other way to do this apart from storing the search parameters in a table?


SARAVAN - you can use localstorage (if using javascript). this is implemented in quite a few libraries out there and is even used as part of the jquery .data() method. i'm using mvc2 and make a lot of use of this mechanism - it works!!

see:

http://dev.w3.org/html5/webstorage/#the-localstorage-attribute

or

http://en.wikipedia.org/wiki/Web_Storage

or

http://msdn.microsoft.com/en-us/library/cc197062%28VS.85%29.aspx

jim

[edit] some localstorage jquery links:

http://plugins.jquery.com/project/DOMCached

http://plugins.jquery.com/project/jStorage

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜