Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Show Parent Document Name In Transformation View modes: 
User avatar
Member
Member
Cliff - 9/18/2013 3:52:39 PM
   
Show Parent Document Name In Transformation
Forum has some posts about this with version 5.x but I was curious if anything is prebuilt for this yet?

I have Parent/Category/Article and on both Parent and Category pages I need to show the direct parent name of the Article.

The articles are displayed in a repeater with a transformation.

User avatar
Member
Member
kentico_sandroj - 9/18/2013 4:04:09 PM
   
RE:Show Parent Document Name In Transformation
Hello,

If you are simply looking to return the parentID of the given node to use to obtain the image you can use <%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%cmscontext.currentdocumentparent.nodeid%}") %> which will return the currently viewed documents parent node ID, or <%# Eval("nodeParentID") %> which will return the parent id of any document. If you need to select more information for your transformation, you need to create custom transformation function for this purpose. Then, you can use “NodeParentID” [ Eval(“NodeParentID”) ] as input variable in your custom transformation function. Then you can get any information from parent node in code of your custom function when getting TreeNode object from NodeID (in your case from ParentNodeID) and return any information from parent Node.

User avatar
Kentico Legend
Kentico Legend
Accepted solutionAccepted solution
Brenden Kehren - 9/19/2013 11:43:57 AM
   
RE:Show Parent Document Name In Transformation
Check this out
<%# CMS.CMSHelper.CMSContext.CurrentDocument.Parent.DocumentName %>