By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

A Beginner question DropDown list box

P: n/a
Hi Folks,
I have a form with two Dropdown list boxes, which get loaded with data from
Database.

DropDownList1 gets data from Table1
and
DropDownList2 gets data from Table2

Table1 has a parent child relationship with Table2 ( has a foreign key to
Table1)

DropdrownList2 needs to be loaded with the data depending up on the
selection in the 1st DropDown.

Can you guys please tell me what is the best way to implement it.

In coldFusion I did this way back by creating Data Arrays with the data in
Table1 and Table2 andimplemented the rest with ClientSide java script
loading data in the second Dropdown...
I think you guys got the picture :).

Tell me a couple of ways of doing it please. I could not find a way to
create client side Array with .NET.

Thanks in Advance,
a .NET beginner
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Somewhat simply put... the way I know how to do it

Populate DropDownList1 with data from Table1
Listen for selection event on DropDownList1
In handling event Populate DropDownList2 with info from Table2
Listen for selection event on DropDownList2
Do whatever you want next...

This way requires that when the dropdownlist value is changed that it
submits a form (POST) and then runs the selection event... something like
that.

Bryan
"anonymous" <an*******@msn.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Folks,
I have a form with two Dropdown list boxes, which get loaded with data from Database.

DropDownList1 gets data from Table1
and
DropDownList2 gets data from Table2

Table1 has a parent child relationship with Table2 ( has a foreign key to
Table1)

DropdrownList2 needs to be loaded with the data depending up on the
selection in the 1st DropDown.

Can you guys please tell me what is the best way to implement it.

In coldFusion I did this way back by creating Data Arrays with the data in
Table1 and Table2 andimplemented the rest with ClientSide java script
loading data in the second Dropdown...
I think you guys got the picture :).

Tell me a couple of ways of doing it please. I could not find a way to
create client side Array with .NET.

Thanks in Advance,
a .NET beginner

Nov 18 '05 #2

P: n/a
Thanks Bryan,
If I write an event to post back on List1 Select then it could be expensive
one and going back and forth on a lower Bandwidth might not be a good idea.
I know transfer a whole lot of data makes similar problems but looks like
that is better evil.

any other ideas?
"Bryan Masephol" <ma******@uwec.edu> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Somewhat simply put... the way I know how to do it

Populate DropDownList1 with data from Table1
Listen for selection event on DropDownList1
In handling event Populate DropDownList2 with info from Table2
Listen for selection event on DropDownList2
Do whatever you want next...

This way requires that when the dropdownlist value is changed that it
submits a form (POST) and then runs the selection event... something like
that.

Bryan
"anonymous" <an*******@msn.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Folks,
I have a form with two Dropdown list boxes, which get loaded with data

from
Database.

DropDownList1 gets data from Table1
and
DropDownList2 gets data from Table2

Table1 has a parent child relationship with Table2 ( has a foreign key to Table1)

DropdrownList2 needs to be loaded with the data depending up on the
selection in the 1st DropDown.

Can you guys please tell me what is the best way to implement it.

In coldFusion I did this way back by creating Data Arrays with the data in Table1 and Table2 andimplemented the rest with ClientSide java script
loading data in the second Dropdown...
I think you guys got the picture :).

Tell me a couple of ways of doing it please. I could not find a way to
create client side Array with .NET.

Thanks in Advance,
a .NET beginner


Nov 18 '05 #3

P: n/a
I don't know if I don't see some things, but I certainly
cannot find the "too much data" coming in due to the
postback.

Make sure you put most of the code in the PAGE_LOAD
function within the if (!IsPostBack) { } block. And the
code you write for the LIST1 selection-change will be
only retrieving values for the LIST2 (which is
inevitable). So where are the extra bytes coming in?

If you want to avoid the postback (the annoying screen-
flashing), you will have to download all the records
possible for LIST2 and then use javascript to filter the
second LIST depending on the selection in the first LIST.
I do NOT recommend this method, of course unless you are
talking about a maximum of 10 or 15 items.

-----Original Message-----
Thanks Bryan,
If I write an event to post back on List1 Select then it could be expensiveone and going back and forth on a lower Bandwidth might not be a good idea.I know transfer a whole lot of data makes similar problems but looks likethat is better evil.

any other ideas?
"Bryan Masephol" <ma******@uwec.edu> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Somewhat simply put... the way I know how to do it

Populate DropDownList1 with data from Table1
Listen for selection event on DropDownList1
In handling event Populate DropDownList2 with info from Table2
Listen for selection event on DropDownList2
Do whatever you want next...

This way requires that when the dropdownlist value is changed that it submits a form (POST) and then runs the selection event... something like that.

Bryan
"anonymous" <an*******@msn.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
> Hi Folks,
> I have a form with two Dropdown list boxes, which get loaded with data
from
> Database.
>
> DropDownList1 gets data from Table1
> and
> DropDownList2 gets data from Table2
>
> Table1 has a parent child relationship with Table2 (
has a foreign keyto > Table1)
>
> DropdrownList2 needs to be loaded with the data
depending up on the > selection in the 1st DropDown.
>
> Can you guys please tell me what is the best way to implement it. >
> In coldFusion I did this way back by creating Data Arrays with the data
in > Table1 and Table2 andimplemented the rest with

ClientSide java script > loading data in the second Dropdown...
> I think you guys got the picture :).
>
> Tell me a couple of ways of doing it please. I could not find a way to > create client side Array with .NET.
>
> Thanks in Advance,
> a .NET beginner
>
>


.

Nov 18 '05 #4

P: n/a
Thanks Michelle,
How could I achieve the second one.I do not like Flashing windows in
response to selection of an item.
I agree the data transfer is very little but the same data transferred for
more than once takes multiple of the initial load time.

I used to use <%....%> in asp to achieve the forbidden method( :) just
kidding) of client side scripting. The Script tags were used to create a
data array with Database data relevent to the page.

Could anyone please tell me the relevent one here.

Thanks

"Michelle Stone" <mi********@yahoo.com> wrote in message
news:06****************************@phx.gbl...
I don't know if I don't see some things, but I certainly
cannot find the "too much data" coming in due to the
postback.

Make sure you put most of the code in the PAGE_LOAD
function within the if (!IsPostBack) { } block. And the
code you write for the LIST1 selection-change will be
only retrieving values for the LIST2 (which is
inevitable). So where are the extra bytes coming in?

If you want to avoid the postback (the annoying screen-
flashing), you will have to download all the records
possible for LIST2 and then use javascript to filter the
second LIST depending on the selection in the first LIST.
I do NOT recommend this method, of course unless you are
talking about a maximum of 10 or 15 items.

-----Original Message-----
Thanks Bryan,
If I write an event to post back on List1 Select then it

could be expensive
one and going back and forth on a lower Bandwidth might

not be a good idea.
I know transfer a whole lot of data makes similar

problems but looks like
that is better evil.

any other ideas?
"Bryan Masephol" <ma******@uwec.edu> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Somewhat simply put... the way I know how to do it

Populate DropDownList1 with data from Table1
Listen for selection event on DropDownList1
In handling event Populate DropDownList2 with info from Table2 Listen for selection event on DropDownList2
Do whatever you want next...

This way requires that when the dropdownlist value is changed that it submits a form (POST) and then runs the selection event... something like that.

Bryan
"anonymous" <an*******@msn.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
> Hi Folks,
> I have a form with two Dropdown list boxes, which get loaded with data from
> Database.
>
> DropDownList1 gets data from Table1
> and
> DropDownList2 gets data from Table2
>
> Table1 has a parent child relationship with Table2 ( has a foreign key
to
> Table1)
>
> DropdrownList2 needs to be loaded with the data

depending up on the > selection in the 1st DropDown.
>
> Can you guys please tell me what is the best way to implement it. >
> In coldFusion I did this way back by creating Data Arrays with the data
in
> Table1 and Table2 andimplemented the rest with

ClientSide java script > loading data in the second Dropdown...
> I think you guys got the picture :).
>
> Tell me a couple of ways of doing it please. I could not find a way to > create client side Array with .NET.
>
> Thanks in Advance,
> a .NET beginner
>
>

.

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.