简体   繁体   English

嵌套中继器-有3个中继器

[英]Nested Repeaters - have 3 repeaters

I understand the OnItemDatabound attribute on the Parent Repeater ... makes sense 我了解父级中继器上的OnItemDatabound属性...很有意义

Here is my question: 这是我的问题:

lets say my data is structured as follows: 可以说我的数据结构如下:

<List>
Parent Level Movie String
   Next Level : Amenities <List>
       Next level:   Showtimes <List>

So I was creating a List of Movies, within that list of Movies is a List of Amenities, within that list of Amenities is the Showtimes 所以我创建了一个电影列表,在该电影列表中是一个设施列表,在那个设施列表中是放映时间

  Movies is Repeater 1 Amenities is Repeater 2 Child of Repeater 1 Showtimes is Repeater 3 Child of Repeater 2 

So, my question is Movies is in a list, and each of the different Repeater items are in a list, can those lists just be used as the DataSource for each Child Repeater, since the data is already contained. 因此,我的问题是电影位于列表中,并且每个不同的Repeater项都位于列表中,这些列表是否可以用作每个Child Repeater的数据源,因为数据已经包含在内。

Yes, they can. 是的他们可以。 It's not even hard. 甚至都不难。 Your markup can just look something like this: 您的标记看起来可能像这样:

<asp:Repeater runat="server">
    <ItemTemplate>
        <asp:Label runat="server" Text='<%# Eval("Title") %>' />

        <asp:Repeater runat="server" DataSource="Amenities ">
            <ItemTemplate>
                <asp:Label runat="server" Text='<%# Eval("SomeField") %>' />

                <asp:Repeater runat="server" DataSource="Showtimes">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" 
                            Text='<%# Eval("SomeOtherField") %>' />
                    </ItemTemplate>
                </asp:Repeater>
            </ItemTemplate>
        </asp:Repeater>
    </ItemTemplate>
</asp:Repeater>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM