Author: edikt | Posted on: 1/11/2010 6:25:47 PM | Views : 417

Hello,
I want to add multiple DropDownLists to my ASP.NET page with C# when another dropdownlist changes.
It works with one DropDownList but my problem is that I want to create new ones in a for-loop.
This is what I have now:


protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { DropDownList lijst = new DropDownList(); SqlDataReader ddDR = null; SqlConnection ddSqlConnection = new SqlConnection(Database.getConnectionString()); SqlCommand ddSqlCommand = new SqlCommand("SELECT naam FROM AANNEMER", ddSqlConnection); ddSqlConnection.Open(); ddDR = ddSqlCommand.ExecuteReader(CommandBehavior.CloseConnection); int aantalGeselecteerdeAannemers = Convert.ToInt32(DropDownList2.SelectedItem.ToString()); lijst.DataSource = ddDR; lijst.ID = ...

Go to the complete details ...