Two Dropdown lists

Dec 2 2003 5:03 AM
Does anyone have a working eg in C# of one dropdown list being populated by the selection of the first. i.e. I need to populate the second dropdown with data related to what is chosen in the first one. Here's the code I use for the second dropdown: /**************************************************************************** String MyQuery = "SELECT DivisionDesc, DivisionNo FROM Divisions Where CompanyNo = " + (Int32.Parse(ddfirstList.SelectedItem.Value)-1); SqlDataAdapter MyCommand_Priot = new SqlDataAdapter(MyQuery, sqlConnection1); DataSet DS_Priot = new DataSet(); MyCommand_Priot.Fill(DS_Priot, "Divisions"); DataRowView ViewRow = DS_Priot.Tables["Divisions"].DefaultView[0]; ddSecondList.DataSource = DS_Priot.Tables["Divisions"].DefaultView; ddSecondList.DataTextField = "DivisionDesc"; ddSecondList.DataValueField = "DivisionNo"; ddSecondList.DataBind(); ****************************************************************************/ Every time I run it it comes back blank... Please show me what I'm overlooking. Thanks. Leon

Answers (3)