title: Binding a dropdownlist and then adding a new listitem
body: <p>I have a <code>DropDownList</code> which I initialize in a function called <code>CreateChildControls</code> before adding it to the <code>Controls</code> collections. I then override the <code>Render()</code> method and then render the <code>DropDownList</code>. The web part inherits from <code>System.Web.UI.WebControls.WebParts.WebPart</code>. </p>
  
  <p>I bind the <code>DropDownList</code> in my web part like this:</p>
  
  <pre><code>private void BindClientTypes()
  {
      DataTable dt = DB.GetAllClientTypes();
  
      if (dt == null)
      {
          ltGlobalErrorMsg.Text = GlobalErrorMessage;
          ltGlobalErrorMsg.Visible = true;
      }
      else
      {
          ddlClient.DataSource = dt;
          ddlClient.DataValueField = "ID";
          ddlClient.DataTextField = "Name";
          ddlClient.DataBind();
          ddlClient.Items.Insert(0, PleaseSelectItem);
      }
  }
  </code></pre>
  
  <p>If I try to set the <code>SelectedIndex</code> of the <code>DropDownList</code> after calling <code>DataBind</code>, I get an error which says the control cannot have multiple selected items.</p>
  
  <p>That code works fine, and I can set the <code>SelectedIndex</code> after the data bind if I comment out this line:</p>
  
  <pre><code>ddlClient.Items.Insert(0, PleaseSelectItem);
  </code></pre>
  
  <p>Can anyone explain why this wouldn't work?</p>
  
  <p>Thanks.</p>