G
Guest
Is it possible to have nested repeaters three layers deep
I have gotten it to work with only two, and when I tried to get the third layer to work
COD
<asp:repeater id="rep" runat="server"><ItemTemplate><span style="BACKGROUND-COLOR: silver"><%# DataBinder.Eval(Container.DataItem, "CustomerID") %> 
<%# DataBinder.Eval(Container.DataItem, "CompanyName") %></span><br /><asp:repeater id="childRepeater" runat="server" datasource='<%# ((DataRowView)Container.DataItem
.Row.GetChildRows("relation") %>' ><itemtemplate> <%# DataBinder.Eval(Container.DataItem, "[\"OrderID\"]") %>
<%# DataBinder.Eval(Container.DataItem, "[\"OrderDate\"]") %><br /><asp:repeater id="Repeater1" runat="server" datasource='<%# ((DataRowView)Container.DataItem
.Row.GetChildRows("orderrel") %>' ><itemtemplate> <%# DataBinder.Eval(Container.DataItem, "[\"ProductID\"]") %>
<%# DataBinder.Eval(Container.DataItem, "[\"UnitPrice\"]") %><br /></itemtemplate></asp:repeater></itemtemplate></asp:repeater></ItemTemplate></asp:repeater
/COD
I got this error on the datasource line
Specified cast not vali
COD
<asp:repeater id="Repeater1" runat="server" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("orderrel") %>'
/COD
By the way, all of this is built against the Northwind database for testing purposes. I can post my codebehind for all of the relations if you want. However, I checked it by commenting out the top layer of relations and only using the bottom two repeaters with orders and order details, and it works fine
-Thanks
I have gotten it to work with only two, and when I tried to get the third layer to work
COD
<asp:repeater id="rep" runat="server"><ItemTemplate><span style="BACKGROUND-COLOR: silver"><%# DataBinder.Eval(Container.DataItem, "CustomerID") %> 
<%# DataBinder.Eval(Container.DataItem, "CompanyName") %></span><br /><asp:repeater id="childRepeater" runat="server" datasource='<%# ((DataRowView)Container.DataItem
.Row.GetChildRows("relation") %>' ><itemtemplate> <%# DataBinder.Eval(Container.DataItem, "[\"OrderID\"]") %>
<%# DataBinder.Eval(Container.DataItem, "[\"OrderDate\"]") %><br /><asp:repeater id="Repeater1" runat="server" datasource='<%# ((DataRowView)Container.DataItem
.Row.GetChildRows("orderrel") %>' ><itemtemplate> <%# DataBinder.Eval(Container.DataItem, "[\"ProductID\"]") %>
<%# DataBinder.Eval(Container.DataItem, "[\"UnitPrice\"]") %><br /></itemtemplate></asp:repeater></itemtemplate></asp:repeater></ItemTemplate></asp:repeater
/COD
I got this error on the datasource line
Specified cast not vali
COD
<asp:repeater id="Repeater1" runat="server" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("orderrel") %>'
/COD
By the way, all of this is built against the Northwind database for testing purposes. I can post my codebehind for all of the relations if you want. However, I checked it by commenting out the top layer of relations and only using the bottom two repeaters with orders and order details, and it works fine
-Thanks