I’d like to know how I can detect that the back button is clicked from the browser.
I have the following situation. On my website I have a search form. When you perform two search actions and then click the back button, the values of my dropdownbox are not stored correctly.
Imagine you search the first time on keywords, after that you search by titles. Now, when you click the back button, you see the results of the keywords, but in the dropdown, titles is still visible. I want keyword to be visible in the dropdown.
In my session I store what the search type is. So that’s why I want to know how to force a page_load on the browser back button.
When I disable the cache I get this error message (IE 7) “Webpage has expired”
PS: I’ve read this thread, but it didn’t answer my question (Forcing page refresh on click of back button)
Perhaps you’re looking for the wrong solution (an ASP.NET solution rather than a browser solution). I think the controls display that way because the browser is trying to be helpful:
If this really bothers you, you could just spit out a little JavaScript to change the selected value when the page loads. Of course, if you have auto-postback on change to that value, this could introduce another problem.