hierarchical menu child pages hidden

Celero Solutions asked on May 21, 2014 14:55

Forgive me if this is a simple question... I've built a hierarchical menu that displays three levels. The menu displays perfectly except the Level 1 Item transformation. At this level I need it to check, 1 - if there are child pages and (if there are that) 2, the child pages are not hidden from the navigation.

In my level 1 item transformation I have this code:

<li<%# IfCompare(Eval("NodeChildNodesCount"),0," class='dropdown-submenu'","") %>><a href="<%# GetDocumentUrl() %>"<%# IfCompare(Eval("NodeChildNodesCount"),0," class='dropdown-toggle' data-toggle='dropdown'","") %>><%# Eval("DocumentName") %>

So, it's only checking if there are childpages (NodeChildNodesCount). The problem is that I have some childpage under this level that are not supposed to be displayed in the navigation and it's parent is detecting that they are there and still displaying "class='dropdown-submenu" when it should be displaying "".

How can I check if the child pages are hidden from the navigation.

Thanks in advance for your help!

Recent Answers

Milan Kačurák answered on May 22, 2014 01:32 (last edited on May 22, 2014 01:33)

I am afraid there is no easy and clean solution for this. You want to check sublevels of level 1. That means you must repeart sublevels of level 1 and check if any of documents has DocumentMenuItemHideInNavigation property set to true. So if you want to render your menu on a server side using Kentico API you should create a custom method for it. Another option is to create JavaScript method and hide class='dropdown-submenu' and class='dropdown-toggle' data-toggle='dropdown' on the client side. Or redesign your document tree structure :)

1 votesVote for this answer Mark as a Correct answer

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