Im currently working on an MVC applicaiton that performs a sequence of steps listed below.
1. User performs a search from the search page which results in the action Search being invoked in the SearchController.
2. The Search action performs filtering and renders the search data in the Search.cshtml (This view supports edit over the searched results.)
3. When the user clicks on the edit link, the Edit action is invoked in the EditController.
4. The Edit action selects the record and renders it in the Edit.cshtml. (This view supports Save and Cancel.)
So heres the question. Within the Edit.cshtml if the user clicks Cancel, the application should show the filterd results back. The issue is passing the filter critera back from the Edit.cshtml to the SearchController's Search action. The point being that
Edit.cshtml would not have any idea about parameters/filter criteria that was passed when the initial search was performed.
Based on your experience what would be the best mechanisum to store the filter criteria (which is a view-model object) in such a senario?
Alternatives at hand would be to use cookies or session, but i assume there would be a much cleaner approch or implementation. Your valuable thoughts are much appriciated.
praneeth wic...
Member
24 Points
6 Posts
Maintaining data between multiple views.
Apr 27, 2012 09:38 AM|LINK
Hi All,
Im currently working on an MVC applicaiton that performs a sequence of steps listed below.
1. User performs a search from the search page which results in the action Search being invoked in the SearchController.
2. The Search action performs filtering and renders the search data in the Search.cshtml (This view supports edit over the searched results.)
3. When the user clicks on the edit link, the Edit action is invoked in the EditController.
4. The Edit action selects the record and renders it in the Edit.cshtml. (This view supports Save and Cancel.)
So heres the question. Within the Edit.cshtml if the user clicks Cancel, the application should show the filterd results back. The issue is passing the filter critera back from the Edit.cshtml to the SearchController's Search action. The point being that Edit.cshtml would not have any idea about parameters/filter criteria that was passed when the initial search was performed.
Based on your experience what would be the best mechanisum to store the filter criteria (which is a view-model object) in such a senario?
Alternatives at hand would be to use cookies or session, but i assume there would be a much cleaner approch or implementation. Your valuable thoughts are much appriciated.
-Praneeth