I have a very simple ASP.NET MVC site that displays images from a database. The user fills in some search parameters, and the view returns a list of images from the database that match the search criteria.
Now I add Pagination, where, depending on the page number, I skip a certain number of images retrieved from the database. This works for me for the first page. My search parameters are lost when I click on the second page of results, because I donโt have a mechanism to store search parameters between views at the moment.
What is the best approach to take. I could have many search options. Should I store them all in a session or in hidden fields? It looks like a hack. Should I have a separate ViewModel to store the search parameters and save them in the session?
What is a typical approach?
Lance source
share