title: ASP .NET Repeater inside Repeater
body: <p>I am trying to create a child <strong>Repeater</strong> inside of a parent <strong>Repeater</strong> in an <strong>*.aspx</strong> page.</p>
  
  <p>I have a small problem which i can't figure out how to resolve. (I will show in the attached image)</p>
  
  <p><img src="https://i.stack.imgur.com/VAlXT.png" alt="The table i am creating is displayed as a single row"></p>
  
  <p>The code is bellow:</p>
  
  <pre><code>&lt;asp:Panel ID="pnlUserActionSummary" runat="server" Visible="false"&gt;
      &lt;h3&gt;&lt;b&gt;User Actions&lt;/b&gt;&lt;/h3&gt;
      &lt;hr/&gt;
  
      &lt;asp:Repeater id="UserActionDetailsRepeader" runat="server" OnItemDataBound="UserActionDetailsRepeadetItemBound"&gt;
          &lt;ItemTemplate&gt;
              &lt;h3&gt;&lt;b&gt;&lt;asp:Literal ID="lit1" runat="server" Text='&lt;%# Eval("PhaseDisplayName") %&gt;'&gt;&lt;/asp:Literal&gt;&lt;/b&gt;&lt;/h3&gt;
  
              &lt;asp:Literal ID="lu1" runat="server" Text="Started On: "&gt;&lt;/asp:Literal&gt; 
              &lt;asp:Literal ID="lu2" runat="server" Text='&lt;%#Eval("PhaseStartedOn")%&gt;'&gt;&lt;/asp:Literal&gt;
  
              &lt;br/&gt;
              &lt;asp:Literal ID="lu3" runat="server" Text="Status: "&gt;&lt;/asp:Literal&gt; 
              &lt;asp:Literal ID="lu4" runat="server" Text='&lt;%# Eval("PhaseStatus") %&gt;'&gt;&lt;/asp:Literal&gt;
  
              &lt;br/&gt;
              &lt;br/&gt;                                
  
              &lt;asp:Repeater ID="TaskDetailsRepeater" runat="server"&gt;
                  &lt;HeaderTemplate&gt;
                      &lt;table&gt;
                          &lt;thead&gt;
                              &lt;tr&gt;
                                  &lt;th&gt;&lt;asp:Literal ID="l1" runat="server" Text="User"&gt;&lt;/asp:Literal&gt;&lt;/th&gt;
                                  &lt;th&gt;&lt;asp:Literal ID="l2" runat="server" Text="Status"&gt;&lt;/asp:Literal&gt;&lt;/th&gt;
                                  &lt;th&gt;&lt;asp:Literal ID="l3" runat="server" Text="Completed On"&gt;&lt;/asp:Literal&gt;&lt;/th&gt;
                                  &lt;th&gt;&lt;asp:Literal ID="l4" runat="server" Text="Comment"&gt;&lt;/asp:Literal&gt;&lt;/th&gt;
                              &lt;/tr&gt;
                          &lt;/thead&gt;
                          &lt;tbody&gt;
                              &lt;tr runat="server" id="itemPlaceholder"&gt;
                              &lt;/tr&gt;
                          &lt;/tbody&gt;
                      &lt;/table&gt;
                  &lt;/HeaderTemplate&gt;
  
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "UserName")%&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "Status")%&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "CompletedOn")%&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "Comment")%&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
  
              &lt;br /&gt;
              &lt;br /&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:Repeater&gt;
  
      &lt;br /&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>Can you suggest me please how can I change the code in order to have a real table, not a simple line.</p>
  
  <p>The collections I bind:</p>
  
  <pre><code>    private void PlaceToBindParentDataSource()
      {        
          UserActionDetailsRepeader.DataSource = UserActions;
          UserActionDetailsRepeader.DataBind();
      }        
  
      protected void UserActionDetailsRepeadetItemBound(object sender, RepeaterItemEventArgs args)
      {            
          Repeater childRepeater = (Repeater)args.Item.FindControl("TaskDetailsRepeater");
  
          var boundItem = (UserActionsDetails)args.Item.DataItem;
          var userAction = UserActions.FirstOrDefault(x =&gt; x.Key.Equals(boundItem.Key));
          var itemTaskDetails = userAction.TaskDetails;
  
          childRepeater.DataSource = itemTaskDetails;
          childRepeater.DataBind();              
      }
  
      protected List&lt;UserActionsDetails&gt; UserActions;
  
      public class UserActionsDetails
      {
          public Guid Key { get; set; }
          public string PhaseDisplayName { get; set; }
          public string PhaseStatus { get; set; }
          public string PhaseStartedOn { get; set; }
          public List&lt;TaskDetails&gt; TaskDetails { get; set; }
      }
  
      public class TaskDetails
      {
          public string UserName { get; set; }
          public string Status { get; set; }
          public string CompletedOn { get; set; }
          public string Comment { get; set; }
      }  
  </code></pre>
  
  <p>Thanks.</p>