title: Selecting and building a Control from a control library dynamically, using the control name from a table
body: <p>I have a custom DDL that lives in my Server control library.  </p>
  
  <p>Currently I add this control to a table by strongly typing the name of the control, the customary way.</p>
  
  <pre><code>Control_Library.Report_NumberDDL newDDL = new Control_Library.Report_NumberDDL();
  </code></pre>
  
  <p>What I want to be able to do is dynamically create that control by pulling the control name from a table.  </p>
  
  <p>So I would have the name of the control in my code, in this case "Report_NumberDDL", and I would like to then create the control without having to strongly type it.  </p>
  
  <p>Something like this, though I know this doesn't work:</p>
  
  <pre><code>string controlName = "Report_NumberDDL";
  
  Control_Library."controlName" controlNum1 = new Control_Library."controlName"();
  </code></pre>
  
  <p>SO since that obviously doesn't work can somebody help me with what would work?  </p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>I tried to do this:  </p>
  
  <pre><code>    Type type = Type.GetType("Control_Library.Report_NumberDDL");
      object control = Activator.CreateInstance(type);
  </code></pre>
  
  <p>But on the CreateInstance(type) I get a null value exception.  So the Type isn't getting created correctly.</p>