You can get this navigation working like like. However for the sub nav class="sub-nav" to be visible at all time you will need to configure this in your css stylesheet.
var nav = Model.AncestorOrSelf(1).Descendants("docTypeName").Where("Visible").Items;
<ul> @foreach(var n in nav){ <li><a href="@n.Url">@n.Name</a> @if(n.Children.Where("Visible").Any()){ <ul class="sub-nav"> @foreach(var s in n.Children.Where("Visible")){ <li><a href="@s.Url">@s.Name</a></li> } </ul> } } </ul>
navigation with nested ul
Hi
I have navigation structur that looks like this.
I need the "sub-nav" items/li to be visible all the time.
How do I do this?
/Kate
Hi kate,
You can get this navigation working like like. However for the sub nav class="sub-nav" to be visible at all time you will need to configure this in your css stylesheet.
var nav = Model.AncestorOrSelf(1).Descendants("docTypeName").Where("Visible").Items;
Hi Kate,
I will try to help you. With th code below you should get the printed the navigation structure, that you have described.
Hope this helps.
/Dennis
Hi Dennis
It was exactly what I need.
Thanks
/Kate
Hi Kate,
Fantastic! that I could help you.
/Dennis
is working on a reply...