Having a site where you can search with the below snippet, how do you store the history for each search so that a开发者_如何学JAVA user can press the back-button to get to previous search results and have a populated text-box with the searched values?
<% using(Ajax.BeginForm("TestSearch",
new AjaxOptions { UpdateTargetId = "details" })) { %>
<%= Html.TextBox("search") %>
<input type="submit" value="search" />
<% } %>
Not quite sure if that's enough for what you need, but I guess you need something like one of these plugins: https://stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin.
Here is a decent jQuery, ASP.NET, and Browser History article explaining exactly what you need to do -
http://stephenwalther.com/archive/2010/04/08/jquery-asp-net-and-browser-history
The article takes advantage of the following four JavaScript files:
1.jQuery-1.4.2.js – The jQuery library. Available from the Microsoft Ajax CDN at http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js
2.jquery.pager.js – Used to generate pager for navigating records. Available from http://plugins.jquery.com/project/Pager
3.microtemplates.js – John Resig’s micro-templating library. Available from http://ejohn.org/blog/javascript-micro-templating/
4.jquery.ba-bbq.js – The Back Button and Query (BBQ) Library. Available from http://benalman.com/projects/jquery-bbq-plugin/
精彩评论