title: FindControl in Custom ITemplate
body: <p>I have a custom UserControl which uses a simple ITemplate:</p>
  
  <pre><code>&lt;asp:Panel runat="server" ID="pnlExpander" CssClass="expander"&gt;
      &lt;asp:HyperLink runat="server" ID="lnkExpand" Text="More Options" NavigateUrl="#" CssClass="lnkExpand"/&gt;
      &lt;asp:Panel runat="server" ID="pnlContent" CssClass="expanderContent" style="display: none"&gt;
          &lt;asp:PlaceHolder runat="server" ID="plcContent"/&gt;
      &lt;/asp:Panel&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>The template is rendered with two simple properties:</p>
  
  <pre><code>public class Expander {
      private ITemplate _contentTemplate;
          public ITemplate ContentTemplate {
              get { return _contentTemplate; }
              set { _contentTemplate = value; }
      }
      protected override void OnPreRender(EventArgs e) {
              if (ContentTemplate != null) {
                  ContentTemplate.InstantiateIn(plcContent);
              }
      }
  </code></pre>
  
  <p>Everything displays correctly, but I can't use FindControl within the template. I get a reference to my combobox from VS intellisense, but a compilation error that it's null whern I actually load the page.</p>
  
  <p>To find the combobox in th the template, I'm using:</p>
  
  <pre><code>var cboFilterCriticality = AspNetUtils.FindControlRecursive(optionsExpander,"cboFilterCriticality") as DropDownList;
  </code></pre>
  
  <p>And the actual template looks like this on the page:</p>
  
  <pre><code>&lt;l49:Expander runat="server" ID="optionsExpander"&gt;
      &lt;ContentTemplate&gt;
          ... other controls
              &lt;asp:DropDownList ID="cboFilterCriticality" runat="server" ValidationGroup="filterGrid" DataTextField="Key" DataValueField="Value" /&gt;
      &lt;/ContentTemplate&gt;
  &lt;/l49:Expander&gt;
  </code></pre>