How to handle going BACK on a website (ASP.NET VS2009 C#)

Shaitan00

Junior Contributor
Joined
Aug 11, 2003
Messages
358
Location
Hell
I have a problem with my web site when dealing with the BACK button...

Imagine the following, I have a DropDownList that allows the user to select an option which, when selected (_SelectedIndexChanged event) sends me to another web page... The problem comes if the user presses BACK afterwards he is returned to the previous page with the DropDownList that still has the option selected.

Therefore, if the user wants to proceed to that option again he has to change to the empty listing in the DropDownList and then select the option to fire off the _SelectedIndexchanged event.

What I want is that, if the user presses BACK it resets the DropDownList.selectedindex=0 (empty) which forces the user to reselect an option - however no matter what I try when the user presses BACK it always returns to how it was even when I reset the selected index of the DropDownList before leaving the selection page.

Is there some special way to handle the BACK button when creating a website? I want to be able to reset the SelectedIndex of my DropDownList in the case where the user presses BACK ...

Any help would be much appreciated - I can't seem to figure out how to get around this rather annoying bug in my site.

Thanks,
 
Disable the control state for the dropdownlist. Set the default to selectedindex of -1.
 
Back
Top