Depending Drop Down List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ummaria
    New Member
    • Mar 2007
    • 16

    Depending Drop Down List

    Hi, How can I make a drop down list show data from the database depending on another drop down list that has to be selected before i can select the next one?



    please help me on this..........
  • Teenzonez
    New Member
    • Mar 2007
    • 36

    #2
    I hope what you meant was to bind the items to a combobox
    depending on the selected value of another combobox,right?
    in the selectedIndexCh anged event handler of the source combobox,
    store the selected value in a variable.
    Use a sqlcommand object like this there:
    SqlCommand cmd = new SqlCommand("Sel ect <required fieldname> from Table2 where <condition fieldname> = <value stored in the variable>",<Con nection Object>);
    Execute this query using ExecuteReader.. .
    Store the results to an array list..
    Bind the arraylist to the second combobox..

    Regards
    TeenzoneZ

    Comment

    Working...