dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

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

  1. #1
    Join Date
    Jul 2006
    Posts
    53

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

    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,

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    then handle it that way in PageLoad. I assume you're doing a check for postback somewhere?

  3. #3
    Join Date
    Nov 2002
    Location
    London UK
    Posts
    154
    I think you'll find there isn't anyway of doing this. When a user clicks back you are simply moving back up the history stack, the page is just reshown as opposed to reloaded, in other words no page processing occurs, so none of your code actually runs so you can't control the display. The only real alternative is to provide your own back button that actually reloads the previous page but of course the user can still click the browser back button unless you hide it, which I would not recommend.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles