Reset Drop Down List

T

Thom Little

I have a Drop Down List with names and matching URLs. When I select an item
the handler issues a redirect to the specified URL. If I hit "back" on the
new page it takes me back to the page with the Drop Down List and the item I
selected is displayed in the Drop Down List.

How can I reset the Drop Down List to show the original value (i.e., item 0)
instead of the value that I selected?
 
C

Chris Moore

Hi,

I've tried a few times and I'm having trouble reproducing your problem. Could you provide a snippet of code that you are using to do this? I assume that
the redirect occurs in DropDownList.SelectedIndexChanged()? Are you adding elements to your list programatically or are they static?

Chris
--------------------
 
T

Thom Little

Chris:

The complete handler is ...
private void ddlWindows_SelectedIndexChanged(object sender,
System.EventArgs e )
{
Response.Redirect( ddlWindows.SelectedItem.Value );
}

The members are static.
I use AutoPostBack

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Chris Moore said:
Hi,

I've tried a few times and I'm having trouble reproducing your problem.
Could you provide a snippet of code that you are using to do this? I assume
that
the redirect occurs in DropDownList.SelectedIndexChanged()? Are you
adding elements to your list programatically or are they static?
 
D

Dale

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Dale Preston
MCAD, MCSE, MCDBA
 
T

Thom Little

Dale:

Placing it in Page_Load created the exact behavior that I wanted.

Thanks for the help.
 
T

Thom Little

Dale:

Clarification.

Your approach works perfectly if you are using Internet Explorer as your
browser.

Your approach does not work with Firefox, Mozillla, Netscape, or Opera.
 
C

Chris Moore

I tried the code that you have me and there wasn't any problem. But I just noticed from a previous post that your problem is with non-IE browsers. It could
be that this is a "feature" of Foxfire, Mozilla, etc. and there isn't an elegant way to deal with it. I will try to find some information about these browsers and
pass it on if I do. Sorry I couldn't be of more help.

Chris
--------------------
 
T

Thom Little

Chris:

Thank you for the help.

I have almost come to the conclusion that it needs to be done with a script
on the client and not code on the server. There is no way I can find to
reset the index AND do the redirect. It seems to be one or the other.

One possibility is to set a hidden field with the value on the reset pass
and then use that value for the redirect. The problem with that is how to
trigger the second transmission back to the server with the hidden data to
be used in the redirect.

The disable cache approach only seems to work on Internet Explorer.

The page I am playing with is my personal sandbox. It is at
www.tlacsharp.net/thomlittle

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Chris Moore said:
I tried the code that you have me and there wasn't any problem. But I
just noticed from a previous post that your problem is with non-IE browsers.
It could
be that this is a "feature" of Foxfire, Mozilla, etc. and there isn't an
elegant way to deal with it. I will try to find some information about
these browsers and
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top