Get Parent Document Name in transformation

Conor Dunk asked on August 15, 2016 14:59

Hi, i'm very new to Kentico so apologises if this is basic. I'm trying to get the document name of the parent page in a hierarchical transformation, currently i'm trying to use:

{% CurrentDocument.Parent.DocumentName %}

All I seem to return is "(root)"?

Thank you in advance for any help. Conor

Correct Answer

Anton Grekhovodov answered on August 15, 2016 15:37

Hi Conor,

It returns the name of parent for your node where you placed a control.

If you want to get a parent node name for current item in repeater, try to use this code in your transformation:{% Documents[NodeAliasPath].Parent.DocumentName %}

And you can add a cache for this macro, example:

{% Cache(Documents[NodeAliasPath].Parent.DocumentName, 5, true, "Parent|" + NodeAliasPath, GetCacheDependency("nodes|<site name>|<page type code name>|all")) %}
2 votesVote for this answer Unmark Correct answer

Recent Answers


Zachary Perry answered on August 15, 2016 15:35

{% CurrentDocument.Parent.DocumentName %} Will return the parent name of whichever page the web part is on. Are you trying to get the parent name of the item in the query?

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on August 15, 2016 15:43

As mentioned above CurrentDocument is the page your webpart is placed upon. Not the data item you're listing in your hierarchical view.

Can't you just start the hierarchical viewer one level higher? If this doesn't fit your markup you could determine the place to start the subitems of an item using the following:

ASCX transformations:

<cms:SubLevelPlaceHolder runat="server" ID="plcSub" />

Text transformations:

{^SubLevelPlaceHolder^}

More info: https://docs.kentico.com/display/K9/Using+hierarchical+transformations#Usinghierarchicaltransformations-Settingthelocationofsublevelsintransformations

0 votesVote for this answer Mark as a Correct answer

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