The article Best Practices for Implementing Site Navigation in Kentico written by Ondrej Vasil May 13, 2015 indicates you can use the following Subitems Check; {% if (NodeHasChildren) { return "has-subitems" } %}
How is this used in ascx transformations and what is the Syntax to display a sublevel menu?
I am unsure how to code this in my hierarchical transformation.
The zero level in my hierarchical transformation needs to output the following; <li class="nav-item active"><a class="nav-link active" href="#">Home <span class="sr-only">(current)</span></a></li>
<li class="nav-item active"><a class="nav-link active" href="#">Home <span class="sr-only">(current)</span></a></li>
The one level in my hierarchical transformation needs to output the following html; <li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pages</a>
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pages</a>
Try to use this code. Don't forget add NodeHasChildren into columns property of Hierarchical viewer web part.
<li class="nav-item<%# Eval<bool>("NodeHasChildren") ? " dropdown" : "" %>">
This worked and I had to add the following fields to the Hierarchical Transformation web part config;
NodeSiteID, MenuItemName, NodeAliasPath, DocumentUrlPath
Thank you so much for the help.
Please, sign in to be able to submit a new answer.