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
I must be overlooking something incredibly simple:
All I want to do is output a list of any content nodes where a certain property is true.
<ul> @foreach (var item in @Model.Children.Where("certainProperty = true")) { <li>@item.Name</a></li> }</ul>
... Works just fine for the Children of the current node. (Obviously).
However,
<ul> @foreach (var item in @Model.Descendants.Where("certainProperty = true")) { <li>@item.Name</a></li> }</ul>
... Outputs nothing.
What am I missing?
Using the Where clause you can just use the boolean value as follows:
Model.Descendants.Where("certainBooleanProperty")
Thank you - but I'm still having the same problem.
Either way, "Children" works, but "Descendants" does not.
You may try using Descendants as a method:
Model.Descendants().Where("certainBooleanProperty")
That did it - thank you very much!
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
Find descendants where property equals...
I must be overlooking something incredibly simple:
All I want to do is output a list of any content nodes where a certain property is true.
... Works just fine for the Children of the current node. (Obviously).
However,
... Outputs nothing.
What am I missing?
Using the Where clause you can just use the boolean value as follows:
Thank you - but I'm still having the same problem.
Either way, "Children" works, but "Descendants" does not.
You may try using Descendants as a method:
That did it - thank you very much!
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.