Enable navigation drop-down for specific page types

Stephen Herz asked on August 30, 2016 23:45

I am using Kentico9

I am trying to create a menu that only has a drop-down if the node has children of a specific page type. I am using a hierarchical viewer and have applied transformations at each node level. My viewer only pulls in CMS.MenuItem page types. In the transformation, I am calling (bool)Eval("NodeHasChildren") to determine if there are child pages. However, it returns true even if the children are not of type CMS.MenuItem. Is there a way to filter out the other page types or determine the children object types in the transform?

Thanks

Correct Answer

Jan Hermann answered on August 31, 2016 08:24

Yes, you can do both. You can specify your item transformation to apply just for specific page types and you can also check in the transformation if the that listed page has any pages of some type:

{%Documents[NodeAliasPath].Children.Where("ClassName='custom.pagetype'").Count%}

1 votesVote for this answer Unmark Correct answer

Recent Answers


Stephen Herz answered on August 31, 2016 17:51

I had to change my transformation type from ASCX to text, but this worked perfectly.

Thanks

0 votesVote for this answer Mark as a Correct answer

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