Question : Drop Down List and Back Button on Browser - Losing state?

I've got a weird situation going on here that I can't understand.

I have an aspx page that has a couple of drop down lists.  One of them allows the user to filter the data in the report.  The other allows them to change the view type of the report.  Both of these ddls are repopulated on each postback, as their are other controls on the page that allow them to change other criteria for the report, and upon changing the other criteria, the options in these ddls can change as well.

Everything works great.  Until you hit the back arrow on the browser.  The ddls KEEP the same value that was there before.  For example, lets say a drop down list has three options, A, B, and C.  The default is A when I first load the page.  All the data in the report loads according to option A.  Then say I select option B.  The form posts and back comes the report for option B (and option B is the one selected in the ddl).  Now if I hit the back button on my browser (IE, FF, Chrome, doesn't matter which), I get the previous page, with Option A data, but Option B is the one selected in the ddl!

A little more background info.  I have enableviewstate = false (because I repopulate the list every post back), and I have autopostback = false because I'm using a custom client javascript to submit the form (I have a few other hidden fields that I am settings on postback).

I don't see how either of those could have an effect on this behavior (I mean, the browser was served up html that specified the selecte value the last time, so why wouldn't it revert back to that value specified in the original serving?)  I have been doing something similar with the classic ASP page that this is replacing, and I don't get this behavior with the classic asp page.  So what gives!?

Can anyone explain this behavior and tell me how to make it stop!?

Answer : Drop Down List and Back Button on Browser - Losing state?

> So are you telling me there is NO way to prevent this behavior?

Well. It is behavior of the browser, and your server-side generated code can only influence that as far as the browser allows it. I am sure that there are some tricks thinkable with javascript (give each formfield a default value and do a form.reset() at the body.onload). But no success guarantee.
Random Solutions  
 
programming4us programming4us