How do you install multiple CMSRepeaters in Kentico?

Using the Kentico CMS environment (version 7), how could multiple CMS relays be nested?

I tried the following, which binds the parent, but how could you then bind them to them?

<cms:CMSRepeater ID="repProducts" runat="server" ClassNames="cms.product" OrderBy="NodeLevel,NodeOrder" SelectOnlyPublished="true" MaxRelativeLevel="1"> <ItemTemplate> <%# Eval("DocumentName")%> <ul> <li> <cms:CMSRepeater ID="repProductsNested" runat="server" ClassNames="cms.product" OrderBy="NodeLevel,NodeOrder" SelectOnlyPublished="true" MaxRelativeLevel="1" Path="./%"> <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li><%# Eval("DocumentName")%> </ItemTemplate> </cms:CMSRepeater> <FooterTemplate> </ul> </FooterTemplate> </li> </ul> </ItemTemplate> </cms:CMSRepeater> 
+4
source share
2 answers

I think that you are missing two vital attributes of your first relay: DelayedLoading = "true" and NestedControlsID = "repProductsNested" , so your code should look like this:

 <cms:CMSRepeater ID="repProducts" runat="server" ClassNames="cms.product" OrderBy="NodeLevel,NodeOrder" SelectOnlyPublished="true" MaxRelativeLevel="1" NestedControlsID="repProductsNested" DelayedLoading="true"> <ItemTemplate> <%# Eval("DocumentName")%> <ul> <li> <cms:CMSRepeater ID="repProductsNested" runat="server" ClassNames="cms.product" OrderBy="NodeLevel,NodeOrder" SelectOnlyPublished="true" MaxRelativeLevel="1" Path="./%"> <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li><%# Eval("DocumentName")%> </ItemTemplate> </cms:CMSRepeater> <FooterTemplate> </ul> </FooterTemplate> </li> </ul> </ItemTemplate> </cms:CMSRepeater> 
+2
source

As a side item, I would strongly advise NOT using nested repeaters unless you really need to, or if your dataset is quite small. We had a large drop-down menu spanning three levels on one of our sites that worked just that way. There were performance problems on the site, and after finding out the reasons, it was discovered that the menu was the culprit because of this many data bindings. Changing it to use a hierarchical viewer fixed this because it returns a single set of data that can be manipulated using hierarchical transformations.

I think you should look for hierarchical transformations when nested repeaters are possible.

0
source

Source: https://habr.com/ru/post/1483819/


All Articles