Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > 2 dropdownlists

Reply
Thread Tools

2 dropdownlists

 
 
Bart Schelkens
Guest
Posts: n/a
 
      08-09-2004
Hi,

I have a webpage that contains 2 dropdownlists.

One is displaying Categories and the other is displaying sub-categories.
When I click on a categorie in the first dropdownlist, I want the second
list to display
the sub-categories for the selected category.

I tried it using the SelectedIndexChanged but this doesn't fire until a
submit of the page. Is there a way to have the desired effect whitout having
to perform a submit ?

Thanks.


 
Reply With Quote
 
 
 
 
Steve Willcock
Guest
Posts: n/a
 
      08-09-2004
Set the AutoPostBack property of the Categories drop down list to true

--
Steve Willcock, MCSD
http://www.willcockconsulting.com/

"Bart Schelkens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a webpage that contains 2 dropdownlists.
>
> One is displaying Categories and the other is displaying sub-categories.
> When I click on a categorie in the first dropdownlist, I want the second
> list to display
> the sub-categories for the selected category.
>
> I tried it using the SelectedIndexChanged but this doesn't fire until a
> submit of the page. Is there a way to have the desired effect whitout

having
> to perform a submit ?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      08-09-2004
"Steve Willcock" <(E-Mail Removed)> wrote in message
news:cf7c9o$cvv$1$(E-Mail Removed)...

The OP wrote:

> Is there a way to have the desired effect whitout having to perform a

submit ?

And you replied:

> Set the AutoPostBack property of the Categories drop down list to true





 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      08-09-2004
"Bart Schelkens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Is there a way to have the desired effect whitout having to perform a

submit ?

Yes, but I'm going to get flamed for suggesting it

But before I do, you must have a REALLY good reason for not performing a
submit, because that is by far the best way to achieve what you want.

However, if you really don't want to submit, and the datasets in question
are relatively small, you could create a JavaScript client-side array in the
<HEAD> of your page which contains all of the records in the related combo.
Then, when the user selects a different option in the first combo, you call
a client-side JavaScript function which clears the options from the second
combo and repopulates it with only thos options which relate to the
selection in the first combo.

This is not a good idea for several reasons:

1) The array is likely to be large, which will slow the initial load of your
page.

2) If a new option is added to the database, it will not be picked up until
the page actually is refreshed.

Don't do it unless there is a compelling reason to do so...


 
Reply With Quote
 
Bart Schelkens
Guest
Posts: n/a
 
      08-10-2004
Thx,

the autopostback was just what i needed.

"Steve Willcock" <(E-Mail Removed)> wrote in message
news:cf7c9o$cvv$1$(E-Mail Removed)...
> Set the AutoPostBack property of the Categories drop down list to true
>
> --
> Steve Willcock, MCSD
> http://www.willcockconsulting.com/
>
> "Bart Schelkens" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I have a webpage that contains 2 dropdownlists.
> >
> > One is displaying Categories and the other is displaying sub-categories.
> > When I click on a categorie in the first dropdownlist, I want the second
> > list to display
> > the sub-categories for the selected category.
> >
> > I tried it using the SelectedIndexChanged but this doesn't fire until a
> > submit of the page. Is there a way to have the desired effect whitout

> having
> > to perform a submit ?
> >
> > Thanks.
> >
> >

>
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      08-10-2004
"Bart Schelkens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> the autopostback was just what i needed.


So why did your OP ask:

> Is there a way to have the desired effect whitout having to perform a

submit ?

???


 
Reply With Quote
 
Bart Schelkens
Guest
Posts: n/a
 
      08-11-2004
Mark,

the problem was that it only worked when i pushed a submit-button.
And at some point during the refresh I lost the data that was in the
dropdownlists.

With the AutoPostBack it doesn't have that effect.

Maybe I wasn't clear in my question. If so, sorry for that.

"Mark Rae" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Bart Schelkens" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > the autopostback was just what i needed.

>
> So why did your OP ask:
>
> > Is there a way to have the desired effect whitout having to perform a

> submit ?
>
> ???
>
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      08-11-2004
"Bart Schelkens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> the problem was that it only worked when i pushed a submit-button.
> And at some point during the refresh I lost the data that was in the
> dropdownlists.
>
> With the AutoPostBack it doesn't have that effect.
>
> Maybe I wasn't clear in my question. If so, sorry for that.


That's no problem.


 
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
reuse SQLDataReader in multiple dropdownlists? Craig Buchanan ASP .Net 4 01-15-2004 10:23 PM
Positioning in dropdownlists Peter J. Hunter ASP .Net 0 01-14-2004 04:13 AM
DropDownLists in XSLT Colin Basterfield ASP .Net 0 12-17-2003 01:48 AM
Multiple DropDownLists Darren ASP .Net 1 08-18-2003 06:57 AM
parent child dropdownlists acting oddly Craig Buchanan ASP .Net 1 06-27-2003 06:10 PM



Advertisments