Hey, I dont know wats wrong with that code. You should try this code..... @foreach (var page in Model.AncestorOrSelf(4).Children.Where("Visible")) { if (page.Children.Where("Visible").Count() > 0) { @foreach (var subpage in page.Children.Where("Visible")) { <a href="@subpage.Url">@subpage.Name</a> } } }
I forgot to update this post, yes i got it working already. What was missing in my code was a if statement to check wherever their are more nodes under Level 4.
If Yes displays them, but at some point when am on Level 4 my razor script would triggers me some errors since no check is being done before displaying the ancestors.
List SubPages By Level
Hi All,
I have a Sub Navigation which triggers only when am on level 4 of my content section.
So lets say i have subPages under any Node on Level 4 it should display.
However for some reason when am on particular page of level 3 it gives me this error and some other level 3 pages no error!!
Error loading MacroEngine script (file: subpages[razor].cshtml)
Any thgoughts??
//fuji
Hey, I dont know wats wrong with that code. You should try this code..... @foreach (var page in Model.AncestorOrSelf(4).Children.Where("Visible"))
{
if (page.Children.Where("Visible").Count() > 0)
{
@foreach (var subpage in page.Children.Where("Visible"))
{
<a href="@subpage.Url">@subpage.Name</a>
}
}
}
Hi Sobin,
I forgot to update this post, yes i got it working already. What was missing in my code was a if statement to check wherever their are more nodes under Level 4.
If Yes displays them, but at some point when am on Level 4 my razor script would triggers me some errors since no check is being done before displaying the ancestors.
//fuji
is working on a reply...