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?
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..
Comment