c# - Display hierarchal data from list of objects -


i have list of objects want display in particular way, , having way more trouble expecting. need setup follows:

  • parent level 2 (header)
  • child level 3 items in table

this repeats until end of list gets pulled on each pageload. i've taken try @ nested repeaters failed.

<asp:repeater runat="server" id="parentmeetingrepeater" > <itemtemplate>     <h5><%# getparentmeetingname(eval("id")) %></h5>     <hr />      <asp:repeater runat="server" id="childmeetingrepeater" >         <headertemplate>             <table style="width: 100%;">         </headertemplate>         <itemtemplate>             <tr>                 <td>                     <a href="/display.aspx?ccbid=<%# eval("id")%>"><%# eval("name") %></a>                 </td>                 <td>                     <%# eval("description") %>                 </td>             </tr>         </itemtemplate>         <footertemplate>             </table>         </footertemplate>     </asp:repeater> </itemtemplate>                        

there event on parent repeater databind 2nd repeater, realized theres no logic tell display level 3 items parent of level2 id. ideas how might able attack this? i'm thinking nested repeaters might wrong direction. - thanks

after getting advice, ended using listview instead. correct binding list of data objects , nested repeaters driving me mental cleaner route.

               <asp:listview id="uxtaxonomies" runat="server" itemplaceholderid="itemplaceholder">                     <layouttemplate>                         <asp:placeholder id="itemplaceholder" runat="server"></asp:placeholder>                     </layouttemplate>                     <itemtemplate>                         <h5><%#((taxonomydata)container.dataitem).name %></h5>                         <hr/>                         <asp:listview id="uxtaxchildren" runat="server" itemplaceholderid="itemplaceholder" datasource="<%#((taxonomydata)container.dataitem).taxonomy %>">                             <layouttemplate>                                 <table class="noborder">                                     <tbody>                                         <asp:placeholder id="itemplaceholder" runat="server"></asp:placeholder>                                     </tbody>                                 </table>                             </layouttemplate>                             <itemtemplate>                                 <tr>                                     <td><a href="/meetingdisplay.aspx?ccbid=<%#((taxonomydata)container.dataitem).id %>"><%#((taxonomydata)container.dataitem).name %></a>  </td>                                     <td><%#((taxonomydata)container.dataitem).description %></td>                                 </tr>                             </itemtemplate>                         </asp:listview>                     </itemtemplate>                 </asp:listview> 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -