I'm looking for some help with filtering a navigation dropdown.
I have a umbracoNaviHide property on each document type.
I want to be able to check if a level 3 child is visible.
Ive added .Where("Visible") to the if statement instead of Any(), but I get the error -
Cannot implicitly convert type 'System.Linq.IQueryable
Any help would be grateful.
Martin
@foreach (var level3 in level2.Children.Where("Visible"))
{
if (level3.Children.Any())
{
<li class="has-children">
<a href="#3">I Have Children</a>
</li>
}
else
{
<li>
<a href="">I Have No Children or All Children Are Hidden </a>
</li>
}
}
@foreach (var level3 in level2.Children.Where(x => x.IsVisible()))
{
if (level3.Children.Where(x => x.IsVisible().Any())
{
<li class="has-children">
<a href="#3">I Have Children</a>
</li>
}
else
{
<li>
<a href="">I Have No Children or All Children Are Hidden </a>
</li>
}
}
Yeah my level 2 is just the same. I dont think i could use a helper, as each level has a different styling. So it was easier to just build out each level.
Navigation - Check If Children Are Visible
Hi All,
I'm looking for some help with filtering a navigation dropdown.
I have a umbracoNaviHide property on each document type. I want to be able to check if a level 3 child is visible.
Ive added .Where("Visible") to the if statement instead of Any(), but I get the error -
Cannot implicitly convert type 'System.Linq.IQueryable
Any help would be grateful.
Martin
Hi Martin
Use this code:
By the way, what is the type of level2?
Thanks,
Alex
Hi Alex,
Thanks for that.
Yeah my level 2 is just the same. I dont think i could use a helper, as each level has a different styling. So it was easier to just build out each level.
is working on a reply...