473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

2 dropdownlists

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.
Nov 18 '05 #1
7 934
Set the AutoPostBack property of the Categories drop down list to true

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

"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
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.

Nov 18 '05 #2
"Steve Willcock" <st***@N-O-S-P-A-Mwillcockconsulting.com> wrote in message
news:cf*******************@news.demon.co.uk...

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


:-)
Nov 18 '05 #3
"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
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...
Nov 18 '05 #4
Thx,

the autopostback was just what i needed.

"Steve Willcock" <st***@N-O-S-P-A-Mwillcockconsulting.com> wrote in message
news:cf*******************@news.demon.co.uk...
Set the AutoPostBack property of the Categories drop down list to true

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

"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
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.


Nov 18 '05 #5
"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
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 ?

???
Nov 18 '05 #6
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" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
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 ?

???

Nov 18 '05 #7
"Bart Schelkens" <BS********@hotmail.com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
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.
Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: theo | last post by:
Hello..I have a similar issue as yesterday but the situation has slightly changed so perhaps someone can shed some more light on the issue... Program flow - load file,extract xml text tags from...
1
by: Chris | last post by:
Hello All, Need some help here. I'm building an asp.net app that uses a datagrid. I have created a template column and added a dropdownlist to it. What I'd like to happen is have the database...
0
by: Steve Caliendo | last post by:
Hi, I'm having trouble with multiple dynamically generated dropdownlists. On my web page I have several text boxes / labels / checkboxes and dropdownlists I have no problem setting the other...
3
by: Jim Bancroft | last post by:
Hi everyone, I'd like to put some DropDownLists in my DataGrid, populating each from a database query. I'm having a little trouble naming them based on the current record in the DataSet. For...
2
by: Jay | last post by:
I'm having a weird problem in ASP.NET 1.1. I have two DropDownLists in a form. Both lists are build identically but separately. Somehow the DropDownLists are getting crossed in memory, because when...
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
8
by: MattB | last post by:
I have a asp.net 1.1/vb application that has a page with a bunch of dynamically added User Controls. When I add the controls, I set the UserControl.EnableViewState to true. For all my controls...
0
by: ASP Developer | last post by:
I need to design a user control that will contain multiple dropdownlists. I am trying to determine the best approach to do this. I could expose every property that is necessary for all of the...
0
by: Carlos | last post by:
Hi all, I just embedded a dropdownlist templatefield inside a gridview. When I look at the control in design mode, I see 5 dropdownlists, when I bind the data to the gridview, I only bind to 3...
3
by: RSH | last post by:
Hi, I am having this very bizarre occurance with 4 dropdown lists on my ASP .Net page. Each control has its own unique id. When the user selects a value from each of the dropdownlists it is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.