title: Dynamically load specific User Control from dropdownlist in autopostback
body: <p>I have an asp.net webpage with a Dropdown control like this:</p>
  
  <pre><code>&lt;asp:DropDownList ID="TypeDrp" runat="server" 
          OnSelectedIndexChanged="LoadCorrectForm" AutoPostBack="True"&gt;
      &lt;asp:ListItem&gt;X&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Y&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Z&lt;/asp:ListItem&gt;
      &lt;/asp:DropDownList&gt;
  
      &lt;br /&gt;
  
      &lt;asp:PlaceHolder ID="PlaceHolder1" runat="server"&gt;
  
      &lt;/asp:PlaceHolder&gt;
  </code></pre>
  
  <p>I want to dynamically load a control in placeholder1 after postback. which are in folder named "myControls" like this:</p>
  
  <pre><code>XTypeForm.ascx
  YTypeForm.ascx
  ZTypeForm.ascx
  </code></pre>
  
  <p>how should I call and use them correctly?
  some one told me to use sth like this:</p>
  
  <pre><code>protected void LoadCorrectForm(object sender, EventArgs e)
  {
      string SelectedValue = TypeDrp.SelectedItem.ToString();
      Control userControl = GetSpecificUserControl(SelectedValue);
      PlaceHolder1.Controls.Clear();   // Remove old user control
      PlaceHolder1.Controls.Add(userControl);
  }
  </code></pre>
  
  <p>but It has errors and I do not know how to change it for my own code?</p>