views:

708

answers:

4

I have an asp.net ajax website, it full of things happen on the same page without page reload, such as sorting records, paging,... When the user go to another page in the same site and press the browser back button, how can i make the browser save the page state to return to it with the preselected options such as sorting option, page number in the paging.

I knew that there is a history control in the new .net 3.5 but its working in the same page not while navigating from a page to another. Also i am looking for a solution which work in all browsers.

Thanks,

+5  A: 

You dont need 3.5 for the history control, check ScottGu's blog here

Also check if this article helps

A: 

I've heard that this is usually solved by using an iframe instead of XMLHttpRequest. I don't know how to incorporate this advice in an ASP.Net webapp.

Ivan Vučica
+1  A: 

You do what the history plugin suggested above does. I'm assuming under the hood, this is what is going on. When your async-postback comes back to the client side for example, do a JavaScript call to window.location = 'somePage.aspx#anchor1' (an old school HTML anchor), then the next async-postback once back on the client would do window.location = 'somePage.aspx#anchor2', etc. GMail does this when it redirects to your inbox or other labels or folders in your e-mail.

Hope that helps, Nick

nickyt