title: Dynamically adding controls in ASP.NET Repeater
body: <p>I find my self having a repeater control which is being databound to an xml document. My client is now requesting that the Textbox's which are being repeater can be either a Textbox or a Checkbox.</p>
  
  <p>I cannot seem to find an easyway to essentially do the following:</p>
  
  <pre><code>if ((System.Xml.XmlNode)e.Item.DataItem.Attributes["type"] == "text")
  &lt;asp:TextBox runat="server" ID="txtField" Text='&lt;%#((System.Xml.XmlNode)Container.DataItem).InnerText %&gt;' CssClass="std"&gt;&lt;/asp:TextBox&gt;
  else
  &lt;asp:CheckBox runat="server" ID="txtField" Text='&lt;%#((System.Xml.XmlNode)Container.DataItem).InnerText %&gt;' CssClass="std"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>Is there a nice way I can extend my current implementaion without have to rewrite the logic. If I could inject the control via "OnItemDataBound" that would also be fine. But I cannot seem to make it work</p>