title: Can't find control within asp.net repeater?
body: <p>I have the following repeater below and I am trying to find lblA in code behind and it fails. Below the markup are the attempts I have made:</p>
  
  <pre><code>&lt;asp:Repeater ID="rptDetails" runat="server"&gt;
      &lt;HeaderTemplate&gt;
          &lt;table&gt;
      &lt;/HeaderTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;A:&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:Label ID="lblA" runat="server"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>First I tried,</p>
  
  <pre><code>Label lblA = (Label)rptDetails.FindControl("lblA");
  </code></pre>
  
  <p>but lblA was null</p>
  
  <p>Then I tried,</p>
  
  <pre><code>Label lblA = (Label)rptDetails.Items[0].FindControl("lblA");
  </code></pre>
  
  <p>but Items was 0 even though m repeater contains 1 itemtemplate</p>