Dropdown list and browser back button issue

I am working on an ASP.NET VB Web project.  I have a page with a dropdownlist with items (let's say A, B and C).  B is assigned as default selected item.  when a user selects a different item (let's say C) on the dropdownlist it triggers the selectedindexonchange event and do a postback. It all works very well but then when a user clicks on the BACK button of the browser the item the user previsouly selected is highlighted (which is C) but if I look at the code behind using View source from the browser "B" is still marked as SELECTED.  The problem is, if I select B now the selectedindexonchange event won't fire.... how can I solve this problem?  I tried not to cache the page but it still not solve the "SELECTED" issue....
Please help.. very urgent...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The issue is when you click "back" button, it will display the cache version of the page. That's why B is shown "selected" in the source code and that causes the selectedindexonchange event won't fire when you select "B" in the drop list (even the dropdownlist highlighted "C").

try add this to your page_load,
        Response.CacheControl = "no-cache"
and now when user clicks "C" and then click "back" button, it will show "B" as highlighted instead of "C".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seems to me, its browser cache problem
Add the following two lines to your .aspx page and see the difference.

            <meta http-equiv="Expires" content="-1">
            <meta http-equiv="Pragma" content="no-cache">

waimanAuthor Commented:
Thanks for the advices... but things still not quite right....
I put the meta tags and the response.cachecontrol in the code......and that's what happening...
If the default selected item is B (out of A, B, C) in the dropdown list, then when I click on 'C', it kicks off a postback.  Then when I click on the BACK button of the browser, 'B' is highlighted again.  I could still click on A or C and it still works.... occassionally I get the "Warning: Page has expired" from IE in some pages which I am NOT happy with....

However, the ideal situation will be: default item is 'B', when I click on 'C', it kicks off a postback, when I click on the BACK button on the browser, 'C' should be highlighted, and I can click on 'B' again and do another postback.  

The problem I described in my previous posting was: 'B' is always marked as 'SELECTED' behind the scene even 'C' is appeared to be highlighted in the browser, and the postback will not happen (or did weired things) when I click on 'B' again.
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

The back button is really difficult to handle.  Have you tried turning smartnavigation on?  It sometimes interferes with javascript, but you can give it a try.
Use ONLY Response.CacheControl = "no-cache" and page won't get expired.

The flow is:
1st - B is selected by default > if user selects "C", page will post back
2nd - Now "C" is highlighted > click "button" and naturally it will go back to previous page which is (1st)

If user clicks "back" button and select "B" and you want page to post back, they can directly select "B" in 2nd stage.
waimanAuthor Commented:
I ended up have to rewrite the onchange event using attributes.add.  The viewstate was absolutely screwed but I did not have time to investigate what really went wrong.  It fired the onselectedindexchange on the first time in debug mode and it did not happen the second time.... no idea... anyway the problem was bypassed ......
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.