Kentico - Show sibling document name on the parent repeater

104 Views Asked by At

I got the following tree structure.

enter image description here

I have a repeater on Podcast page and need to display the latest sibiling document name on each item on the repeater. So for example, I will have the following in the repeater

  • MHPN Presents Ageing Well - Latest: Episod 1

  • MHPN Presents Trauma and Resilience - Latest: Trauma and Resilience: Trauma, a history

1

There are 1 best solutions below

0
On

You could use webpart within the transformation. Something like that could do what you want. You have to change the ClassNames, SiteName, TransformationName with the one you want. This OrderBy will display the first on the tree. You can change it accordingly if you want something else.

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Viewers_Documents_cmsrepeater"  Codebehind="~/CMSWebParts/Viewers/Documents/cmsrepeater.ascx.cs" %>
<cms:CMSRepeater ID="CMSRepeater1" runat="server" Path="./%" ClassNames="podcast.episode" SiteName="YourSite" TransformationName="podcast.episode.latest" TopN="1" OrderBy="NodeLevel, NodeOrder, NodeName" />

You can have a similar results using a Hierarchical viewer as well. However, since you require only one sibling you cannot do it that easily.

You can find an example at xperience and kentico

There might be small differences depending on the Kentico version you are using.

Dimitris