title: ASP.NET Custom/User Control With Children
body: <p>I want a create a custom/user control that has children.</p>
  
  <p>For Example, I want my control to have the following markup:</p>
  
  <pre><code>&lt;div runat="server" id="div"&gt;
      &lt;label runat="server" id="label"&gt;&lt;/label&gt;
      &lt;div class="field"&gt;
          &lt;!-- INSERT CHILDREN HERE --&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and when I want to use it on a page I simply:</p>
  
  <pre><code>&lt;ctr:MyUserControl runat="server" ID="myControl"&gt;
      &lt;span&gt;This is a child&lt;/span&gt;
      &lt;div runat="server" id="myChild"&gt;And another &lt;b&gt;child&lt;/b&gt;
  &lt;/ctr:MyUserControl&gt;
  </code></pre>
  
  <p>The child controls inside my user control will be inserted into my user control somewhere.  What is the best way to accomplish this?</p>
  
  <p>The functionality is similar to a asp:PlaceHolder but I want to add a couple more options as well as additional markup and the such.  Also the child controls still need to be able to be accessed by the page. (in the example above the page should have the myChild Control on it)</p>
  
  <p>EDIT ------ </p>
  
  <p>It can be a template control as long as it allows me to reference the children on the page.</p>