Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to make like 4 comboboxes where each list within the combobox derives from the previous one. I thought this would be as easy as setting each box to a variable and then using that variable in the query for the combobox after it. I have attempted to use a variable in the query editor in the fillby, and also attempted to use code like this:
            using (SqlConnection cs = new SqlConnection(
@"Data Source=100-olkj-900-ptalog=Report;Persist Security Info=True;User ID=reports;Password=password
            {
                cs.Open();

 
                using DataAdapter da = new SqlDataAdapter(query
                {
                    // 3
                    
                    DataTable t = new DataTable();
                    da.Fill(t);

                    // 4
                    // Render data onto the screen
                    comboBox1.DataSource = t; // <-- From your designer
                    comboBox1.DisplayMember = "station.stationipaddress";
                    comboBox1.ValueMember = "station.stationipaddress";

                }


I am not really sure, what to try...
Any ideas anyone >?
Posted

 
Share this answer
 
Hello Prevatt, This link will help u surely. For this purpose we can use cascading drop downs, these are also so-called dependancy drop downs while loading the consequent drop down it wont effect the entire page i.e, updates only the partial page or specific drop down. Try this code
http://www.aspdotnet-suresh.com/2012/11/country-state-city-cascading.html[^]

Happy Coding....
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900