Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Reset Drop Down List

Reply
Thread Tools

Reset Drop Down List

 
 
Thom Little
Guest
Posts: n/a
 
      07-23-2004
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?

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



 
Reply With Quote
 
 
 
 
Chris Moore
Guest
Posts: n/a
 
      07-23-2004
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
--------------------
>Reply-To: "Thom Little" <>
>From: "Thom Little" <>
>Subject: Reset Drop Down List
>Date: Fri, 23 Jul 2004 15:12:44 -0400
>Lines: 14
>Organization: Thom Little Associates, Ltd.
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
>NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontro ls:22385
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
>
>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?
>
>--
>-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>--
>
>
>
>



 
Reply With Quote
 
 
 
 
Thom Little
Guest
Posts: n/a
 
      07-24-2004
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" <> wrote in message
news:...
> 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
> --------------------
> >Reply-To: "Thom Little" <>
> >From: "Thom Little" <>
> >Subject: Reset Drop Down List
> >Date: Fri, 23 Jul 2004 15:12:44 -0400
> >Lines: 14
> >Organization: Thom Little Associates, Ltd.
> >X-Priority: 3
> >X-MSMail-Priority: Normal
> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> >Message-ID: <>
> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
> >Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP11
..phx.gbl
> >Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet.webcontro ls:22385
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >
> >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?
> >
> >--
> >-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> >--
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Dale
Guest
Posts: n/a
 
      07-24-2004
Response.Cache.SetCacheability(HttpCacheability.No Cache);

Dale Preston
MCAD, MCSE, MCDBA

"Thom Little" <> wrote in message
news:...
> 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?
>
> --
> -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> --
>
>
>



 
Reply With Quote
 
Thom Little
Guest
Posts: n/a
 
      07-24-2004
Dale:

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

Thanks for the help.

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

"Dale" <> wrote in message
news:...
> Response.Cache.SetCacheability(HttpCacheability.No Cache);
>
> Dale Preston
> MCAD, MCSE, MCDBA
>
> "Thom Little" <> wrote in message
> news:...
> > 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?
> >
> > --
> > -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> > --
> >
> >
> >

>
>



 
Reply With Quote
 
Thom Little
Guest
Posts: n/a
 
      07-30-2004
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.

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

"Dale" <> wrote in message
news:...
> Response.Cache.SetCacheability(HttpCacheability.No Cache);
>
> Dale Preston
> MCAD, MCSE, MCDBA
>
> "Thom Little" <> wrote in message
> news:...
> > 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?
> >
> > --
> > -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> > --
> >
> >
> >

>
>



 
Reply With Quote
 
Chris Moore
Guest
Posts: n/a
 
      08-06-2004
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
--------------------
>Reply-To: "Thom Little" <>
>From: "Thom Little" <>
>References: <> <>
>Subject: Re: Reset Drop Down List
>Date: Fri, 23 Jul 2004 20:21:25 -0400
>Lines: 71
>Organization: Thom Little Associates, Ltd.
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
>NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontro ls:22392
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
>
>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" <> wrote in message
>news:...
>> 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
>> --------------------
>> >Reply-To: "Thom Little" <>
>> >From: "Thom Little" <>
>> >Subject: Reset Drop Down List
>> >Date: Fri, 23 Jul 2004 15:12:44 -0400
>> >Lines: 14
>> >Organization: Thom Little Associates, Ltd.
>> >X-Priority: 3
>> >X-MSMail-Priority: Normal
>> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>> >Message-ID: <>
>> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
>> >NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
>> >Path:

>cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGP08.phx.gbl!TK2MSFTNGP11
>.phx.gbl
>> >Xref: cpmsftngxa06.phx.gbl

>microsoft.public.dotnet.framework.aspnet.webcontr ols:22385
>> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
>> >
>> >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?
>> >
>> >--
>> >-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>> >--
>> >
>> >
>> >
>> >

>>
>>

>
>
>



 
Reply With Quote
 
Thom Little
Guest
Posts: n/a
 
      08-07-2004
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" <> wrote in message
news:...
> 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
> --------------------
> >Reply-To: "Thom Little" <>
> >From: "Thom Little" <>
> >References: <>

<>
> >Subject: Re: Reset Drop Down List
> >Date: Fri, 23 Jul 2004 20:21:25 -0400
> >Lines: 71
> >Organization: Thom Little Associates, Ltd.
> >X-Priority: 3
> >X-MSMail-Priority: Normal
> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> >Message-ID: <>
> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
> >Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP11
..phx.gbl
> >Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet.webcontro ls:22392
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >
> >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" <> wrote in message
> >news:...
> >> 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
> >> --------------------
> >> >Reply-To: "Thom Little" <>
> >> >From: "Thom Little" <>
> >> >Subject: Reset Drop Down List
> >> >Date: Fri, 23 Jul 2004 15:12:44 -0400
> >> >Lines: 14
> >> >Organization: Thom Little Associates, Ltd.
> >> >X-Priority: 3
> >> >X-MSMail-Priority: Normal
> >> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> >> >Message-ID: <>
> >> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >> >NNTP-Posting-Host: bgrwebrydthomlittle.prexar.com 142.167.74.159
> >> >Path:

>
>cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGP08.phx.gbl!TK2MSFTNGP1

1
> >.phx.gbl
> >> >Xref: cpmsftngxa06.phx.gbl

> >microsoft.public.dotnet.framework.aspnet.webcontr ols:22385
> >> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> >> >
> >> >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?
> >> >
> >> >--
> >> >-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> >> >--
> >> >
> >> >
> >> >
> >> >
> >>
> >>

> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down scott@dettcom.com Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57