title: How to add a listitem to a dropdownlist that is generated in code behind?
body: <p>I dynamically create dropdowns in my code behind. I want to add a listitem that is the default selection of the dropdown.</p>
  
  <pre><code>int Persons= int.Parse(TextBox_persons.Text) + 1;
  
  for (int i = 1; i &lt; Persons; i++)
  {
       DropDownList DropDownList_menuchoice = new DropDownList();
       DropDownList_menuchoice.DataSource = Menu.GetAllMenus();
       DropDownList_menuchoice.CssClass = "form-control";
       DropDownList_menuchoice.Items.Add(new ListItem("please select a menu", "-1"));
       DropDownList_menuchoice.DataTextField = "titel";
       DropDownList_menuchoice.DataValueField = "titel";
       DropDownList_menuchoice.DataBind();
       Panel1.Controls.Add(DropDownList_menuchoice);
  }
  </code></pre>
  
  <p>Why doesn't this work? I've been looking for the answer online however, everyone is suggestion the <code>items.add</code> code and it's not working for me. It only shows the data that I retrieve from the database, not the listitem I've added in the code above.</p>
  
  <p>Please help me if you know why this is.</p>