Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Please help me to do the for-each via children nodes in the best way ?
Thanks,
Alex
Hi Alex,
It does depend on if you are using a Razor macro or a Mvc view, for a Razor macro, something like:
@{ var root = Model.AncestorOrSelf(1); } <ul> @foreach (var page in root.Children.Where("Visible")) { <li><a href="@page.Url">@page.Name</a></li> } </ul>
If you are using a Mvc view, something like:
@{ var root = Model.Content.AncestorOrSelf(1); } <ul> @foreach (var page in root.Children.Where("Visible")) { <li><a href="@page.Url">@page.Name</a></li> } </ul>
Is that what you were looking for?
Jeavon
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Faster foreach
Please help me to do the for-each via children nodes in the best way ?
Thanks,
Alex
Hi Alex,
It does depend on if you are using a Razor macro or a Mvc view, for a Razor macro, something like:
If you are using a Mvc view, something like:
Is that what you were looking for?
Thanks,
Jeavon
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.