Dropdownlist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey!
I have 3 dropdownlist depending on eash other.

It's a hierarchy. The first dropdownlist generate the second and the second
generate the third.
The first i have a sql query for, so that dropdownlist is generated.
My question is how to generate the second and the third?
 
Hi,
Hey!
I have 3 dropdownlist depending on eash other.

It's a hierarchy. The first dropdownlist generate the second and the second
generate the third.
The first i have a sql query for, so that dropdownlist is generated.
My question is how to generate the second and the third?

If your DB structure has something like
TABLE_1 (ID_1, ...)
TABLE_2 (ID_1, ID_2, ...)
TABLE_3 (ID_1, ID_2, ID_3, ...)

You can easly fill all tables with all records, and the:
1. bind table2 and table3 to dataView2 and dataView3
2. set dataView2.RowFilter=dataView3.RowFilter="1=0";
3. if first combo is set to any value then set
dataView2.RowFilter="ID1="+combo1.SelectedValue;
4. if second combo is set to any value then set
dataView3.RowFilter="ID1="+combo1.SelectedValue
+ " AND ID2="+combo2.SelectedValue;

Of course you can replace the dataViews with filling the table
on first and second combo's change, but i think that
solution with the dataViews is faster (in most of cases).

HTH
Marcin
 
Back
Top