Parent document info into a repeater

lawrence whittemore asked on April 24, 2015 14:40

Is it possible to get parent document info for the item that is being rendered in a transformation. I am using the calendar control and have events showing on it from multiple locations and would like the events parent name to show in the repeater so that the user of the site knows what section that event belongs to.

I'm in version 8

Recent Answers


Brenden Kehren answered on April 24, 2015 14:52

You can use this to get the current documents parent info:

<%# CurentDocument.Parent.DocumentName %>
0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on April 24, 2015 14:58

Thanks. However, that will give me the current document's parent's name not the document that is being rendered in the repeater's parent's name.

I'm trying to do this on the calendar control and the items that are rendered on the calendar are not the currently selected item but items that live in separate sections in the tree all being pulled into one calendar.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 24, 2015 18:50 (last edited on December 10, 2019 02:30)

You are correct! You can create a custom transformation method to do this, unless I'm forgetting something, probably the easiest thing to do. Using a macro you can do something like this although not sure it's available as a C# method.

{% Documents["/Path/To/Find"].Parent.DocumentName |(identity)GlobalAdministrator%}
0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 24, 2015 19:54

One thing I'd like to point out is, you may want to check the SQL debug to see how many SQL calls you are making by doing this.

0 votesVote for this answer Mark as a Correct answer

Cuong Nguyen answered on August 5, 2017 16:40 (last edited on December 10, 2019 02:31)

In Kentico 10, this macro can get parent document info in transformation:

{% Object.Parent.DocumentName |(identity)GlobalAdministrator%}

Not sure if it can work with other Kentico version. Hope this help :)

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.