Search code examples
asp.netajaxupdatepanelpartial-page-refresh

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?


Solution

  • 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.