A Beginner question DropDown list box

  • Thread starter Thread starter anonymous
  • Start date Start date
A

anonymous

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
 
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
 
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?
 
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.
 
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
 
Back
Top