Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Repeat a repeater

Vote:
 

Hi!

I have a Page Template (1) with this code:

<h2><EPiServer:Property runat="server" PropertyName="PageName" /></h2>
            <div class="bread"><EPiServer:Property runat="server" PropertyName="Pufftext" /></div>
            <div class="links">
                <asp:Repeater runat="server" ID="ItemRepeater">
                    <ItemTemplate>
                        <a href='<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).GetMappedHref() %>' 
                        rel='lightbox[<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).Text %>]' 
                        title='<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).Title %>'
                        class='<%# Container.ItemIndex == 0 ? "arrow" : "noClass" %>' >
                        <%# Container.ItemIndex == 0 ? "Visa bilder" : "" %>
                        </a>
                    </ItemTemplate>                
                </asp:Repeater>

Code behind:

LinkItemCollection links = CurrentPage.Property["ImageGallaryControl"].Value as LinkItemCollection;
                    ItemRepeater.DataSource = links;
                    ItemRepeater.DataBind();

        

Following this guide: http://sdk.episerver.com/library/cms5/Developers%20Guide/How%20To/Use%20Link%20Collection%20property.htm

It works great.

 

However, this PageTemplate should be used for child pages. A parent page should then have repeater for these children. Like this Page Template (2):

<EPiServer:PageList ID="VaraFavoriterRepeater" PageLinkProperty="PageLink" runat="server">
                            <ItemTemplate>
                                <div class="vf">
                                    <div class="c1">
                                        <div class="rc-250-top"></div>
                                        <div class="pic"><img src='<%# Container.CurrentPage["Puffbild"] %>' alt='' /></div>
                                        <div class="rc-250-bot"></div>
                                    </div>
                                    <div class="c2">
                                        <h2><EPiServer:Property runat="server" PropertyName="PageName" /></h2>
                                        <div class="bread"><EPiServer:Property runat="server" PropertyName="Pufftext" /></div>
                                        <div class="links">
                                            <asp:Repeater runat="server" ID="ItemRepeater">
                                                <ItemTemplate>
                                                    <a href='<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).GetMappedHref() %>' 
                                                    rel='lightbox[<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).Text %>]' 
                                                    title='<%# (Container.DataItem as EPiServer.SpecializedProperties.LinkItem).Title %>'
                                                    class='<%# Container.ItemIndex == 0 ? "arrow" : "noClass" %>' >
                                                    <%# Container.ItemIndex == 0 ? "Visa bilder" : ""%>
                                                    </a>
                                                </ItemTemplate>                
                                            </asp:Repeater>
                                            <asp:PlaceHolder runat="server" Visible='<%# Container.CurrentPage["MapLink"] != null%>'>
                                                <a href='<%# Container.CurrentPage ["MapLink"] %>' rel='lightbox[<%# Container.CurrentPage ["MapNr"] %>]' title="Visa på kartan" class="arrow right">Visa på kartan</a>
                                            </asp:PlaceHolder>
                                            <div class="cc"></div>
                                        </div>
                                    </div>
                                <div class="cc"></div>
                                </div>
                            </ItemTemplate>
                        </EPiServer:PageList>



The problem is that I cant get to list the things in the repeater of the children. How do I do that?

Thanks


 

#62717
Nov 01, 2012 14:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.