Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Back button functionality to webpage with form and search result + Ajax (ASP.NET)

I have an asp.net form used for search. The search result is showing on the same page using Ajax. If I navigate to another page and come back, I get the populated form but the search result is empty. What's the best way to go back to the page and have the result populated.

Or how to force the page to post back to repopulate the page with the results when back button is clicked?

like image 395
Tony_Henrich Avatar asked Aug 04 '09 00:08

Tony_Henrich


3 Answers

You can do this using the EnableHistory property on the ScriptManager. Once you've set the ScriptManager's EnableHistory property to True, you can use the AddHistoryPoint method to set history points in your page.

<asp:ScriptManager runat="server" ID="MyScriptManager" EnableHistory="True">
</asp:ScriptManager>

Dino Esposito has a good pair of articles here (client-side) and here (server-side) about using the scriptmanager history functionality.

like image 158
Scott Ivey Avatar answered Sep 26 '22 21:09

Scott Ivey


There are a number of frameworks that attempmt to handle the back button and ajax.
Here is Microsoft 's
Here is one called really simple history

like image 31
cptScarlet Avatar answered Sep 23 '22 21:09

cptScarlet


Here are a few more if you are using jQuery:

http://plugins.jquery.com/project/history

http://stilbuero.de/jquery/history/

http://www.overset.com/2008/06/18/jquery-history-plugin/

https://stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin

like image 34
Punit Vora Avatar answered Sep 23 '22 21:09

Punit Vora