title: Repeater control. Using a table that spans rows
body: <p>The following "FindControl" method fails to find the imgAd control. Any idea why? Could it be the Table that contains it? The intent of the table is to line things up in columns across rows.</p>
  
  <pre><code>&lt;asp:Content ID="Content3" ContentPlaceHolderID="phPageContent" runat="Server"&gt;
      &lt;asp:Repeater ID="repBanner" runat="server"&gt;
          &lt;HeaderTemplate&gt;
              &lt;table&gt;
          &lt;/HeaderTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;asp:Image ID="imgAd" runat="server" AlternateText="Panda Visa" ImageUrl="Images/AffiliateBanners/125%20by%20125.jpg" /&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;asp:TextBox ID="txtHtml" runat="server" Columns="80" ReadOnly="True" Rows="7" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                       &lt;asp:Button runat="server" Text="Copy HTML to Clipboard" OnClientClick="ClipBoard('txtHtml')" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
          &lt;FooterTemplate&gt;
              &lt;/table&gt;
          &lt;/FooterTemplate&gt;
      &lt;/asp:Repeater&gt;
  
  
  Protected Sub repBanner_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles repBanner.ItemDataBound
  
      Dim CurrentAd As Ad = CType(e.Item.DataItem, Ad)
      Dim RepeaterItem As RepeaterItem = e.Item
  
      Dim imgAd As Image = CType(RepeaterItem.FindControl("imgAd"), Image)
      imgAd.ImageUrl = "Images/" &amp; "125 by 125.jpg" '&lt;&lt;&lt;Error occurs here
  
  End Sub
  
  Object reference not set to an instance of an object.
  </code></pre>
  
  <p>Here's some debug info that I thought may help:</p>
  
  <pre><code>? RepeaterItem.Controls.Count
  1
  ? RepeaterItem.Controls(0).Controls.Count
  0
  ? typename(RepeaterItem.Controls(0))
  "LiteralControl"
  </code></pre>