2

Say I have the following situation:

  • A paginated View displays a list of contacts with the following route: Contacts/Index/Page/2.
  • The View gets its paginated data ViewModel object.
  • The View also gets its filter properties from the ViewModel, like the Contact Category.

I would like to store the page number and the filter properties somewhere in such a way that when the user returns to Contacts/Index page, the same page number and filters are applied.

Is it good practice to store these properties within a Session variable? Should the ViewModel be handling these Session variables?

Is there another way to tackle this type of situation?

1 Answer 1

3

if you want to have the same filters/page after you have returned from another page back, then you must use session, there is no other better way

Sign up to request clarification or add additional context in comments.

2 Comments

It looks like the user who asked this question is no longer a member of the site.
This is how I had to accomplish the same thing. User performs a search, then edits one of the items from the search, possibly a sequence of multiple pages, and in the end must be returned the original search results. Session variable for the win.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.