Reputation: 498
Implement a link back to a search result page from one of its clicked on results.
What I am trying to do is pass a search query via a back link and to display the result in a view and then run the search query auto.
@Html.ActionLink("Back to List", "Index", new { searchString= TempData["lastSearchString"] } )
I am having trouble trying to implement this concept .
Upvotes: 1
Views: 1782
Reputation: 1659
Is javascript a possibility?
This should retain the search results and text entered. Not sure if it works on all browsers however.
<A HREF="javascript:history.go(-1);">
Upvotes: 1
Reputation: 14297
public ActionResult Index(string sortOrder, string currentFilter, string searchString, int? page)
{
tempdata["lastSearchString"]=searchString;
}
in your view
@Html.ActionLink("Back to List", "Index", new { searchString= tempdata["lastSearchString"] } )
Upvotes: 2
Reputation: 14944
You could implement it using Session variables or by storing a cookie
Upvotes: 0