title: how to make a label in a nested repeater visible programmatically
body: <p>I have two repeaters, one nested in the other. I'm outputting a list of course titles in the parent repeater and the dates of those courses in the child repeater. This part is working fine. But, not all the course titles necessarily have dates available at any given time, so I want to be able to put a message up under each Course title that currently has no dates saying to check back regularly, blah, blah, blah. I've put the label in the footer template of the nested repeater with visibility=false and am trying to set the visibility=true at the appropriate time in the ItemDataBound Sub. Unfortunately, this is not working. I'm not getting any errors, the label just isn't showing up. I'm really hoping someone can help me out with my code or suggest an alternate way to do this. I'm kinda new to asp.net(VB) and am still struggling a bit. I've never tried nesting repeaters before. Here is my code:</p>
  
  <p>.aspx</p>
  
  <pre><code>&lt;asp:Repeater ID="rptTech" runat="server" &gt;
              &lt;HeaderTemplate&gt;
                  &lt;table class="tableCourses"&gt;
              &lt;/HeaderTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;strong&gt;&lt;asp:Label runat="server" ID="lblCourseName" Text='&lt;%# Eval("CourseName") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/strong&gt;
                          &lt;br /&gt;
                          &lt;asp:Label runat="server" ID="lblCourseSummary" Text='&lt;%# Eval("Summary") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;br /&gt;
                          &lt;asp:HyperLink ID="hpCourseMaterial" Visible='&lt;%# CheckCourseMaterial(Eval("CourseMaterial")) %&gt;' NavigateUrl='&lt;%# "/files/Portal_Course_Material/" &amp; Eval("CourseMaterial")%&gt;' Text="Download Course Material" runat="server"&gt;&lt;/asp:HyperLink&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                      &lt;asp:Repeater ID="rptTechDates" DataSource='&lt;%#Eval("relCourses") %&gt;' runat="server" &gt;
                          &lt;HeaderTemplate&gt;
                              &lt;table&gt;
                          &lt;/HeaderTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;strong&gt;&lt;asp:Label runat="server" ID="lblDate" Text='&lt;%# CDate(Eval("dteDate")).ToString("dd/MM/yyyy") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/strong&gt;&lt;br /&gt;
                                      &lt;asp:Label runat="server" ID="dteTime" Text='&lt;%# "Time: " &amp; CDate(Eval("dteTime2")).ToString("HH:mm") &amp; " EST" %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt;
                                      &lt;asp:HyperLink ID="Register" NavigateUrl='&lt;%# "/Test.aspx?intMeetingID2=" &amp; Eval("pkWebinarID")%&gt;' Text="Register" runat="server"&gt;&lt;/asp:HyperLink&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/ItemTemplate&gt; 
                          &lt;FooterTemplate&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;asp:Label ID="lblNoCourses" Text="There are no course dates available at this time. Please check back regularly to see any updates." runat="server" Visible="False"&gt;&lt;/asp:Label&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;/table&gt;
                          &lt;/FooterTemplate&gt;
                      &lt;/asp:Repeater&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;/table&gt;
              &lt;/FooterTemplate&gt;
          &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>And Codebehind:</p>
  
  <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      Dim curDate As Date = CDate(Now)
  
      'Create the connection
      Dim connstring As String
      connstring = ConfigurationManager.ConnectionStrings("LPISQLConn").ConnectionString
  
      Using conn As New SqlConnection(connstring)
          Dim cmd As New SqlCommand("SELECT foo1, foo2, foo3 FROM tblFoo", conn)
          cmd.CommandType = CommandType.Text
  
          Dim ad As New SqlDataAdapter(cmd)
          Dim ds As New DataSet()
          ad.Fill(ds)
          ds.Relations.Add(New DataRelation("relCourses", ds.Tables(0).Columns("fkcrsID"), ds.Tables(1).Columns("webinarID"), False))
          rptTech.DataSource = ds.Tables(0)
          rptTech.DataBind()
      End Using
  End Sub
  
  Protected Sub rptTech_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
      If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
          Dim drv As DataRowView = TryCast(e.Item.DataItem, DataRowView)
          Dim rptTechDates As Repeater = TryCast(e.Item.FindControl("rptTechDates"), Repeater)
          rptTechDates.DataSource = drv.CreateChildView("relCourses")
          If rptTechDates.Items.Count &lt; 1 And rptTechDates IsNot Nothing Then
              If e.Item.ItemType = ListItemType.Footer Then
                  Dim lblNoCourses As Label = TryCast(e.Item.FindControl("lblNoCourses"), Label)
                  If lblNoCourses IsNot Nothing Then
                      lblNoCourses.Visible = True
                  End If
              End If
          Else
              rptTechDates.DataBind()
          End If
  
      End If
  End Sub
  </code></pre>