Failing to select descendants or self based on a where statement
I've gotten around to installing Windows and setting up Visual Studio to run with my new Umbraco 5 installation. I am attemptning to select all nodes in my tree, based on whether or not a field is set to true. The field is called topNavigation. I want to use be able to use intellisense and at the moment I am fiddling with the following code:
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
// I want to get all nodes that have a field set to true.
var root = @Model.CurrentPage.AncestorContentOrSelf().Last();
var topNavigation = @root.DescendantContentOrSelf().Where("topNavigation = True");
}
<ul id="navigation">
@{
// Here I want to do a foreach on the result.
}
</ul>
The part where I use the where mthod fails because IEnumerable does not contain that method.
It also seems that the above code causes my navigation children to be cached. When I uncheck the field "topNavigation" in the node, which comes from an inherit-only content-type, it doesn't refelct on my page when I refresh in a browser. It does however after a few minutes.
Failing to select descendants or self based on a where statement
I've gotten around to installing Windows and setting up Visual Studio to run with my new Umbraco 5 installation. I am attemptning to select all nodes in my tree, based on whether or not a field is set to true. The field is called topNavigation. I want to use be able to use intellisense and at the moment I am fiddling with the following code:
The part where I use the where mthod fails because IEnumerable does not contain that method.
Any ideas?
I tried to edit my topic to make my language clearer but edit throws and XSLT error and it won't let me delete the topic either.
Okay so I have it working perfectly with the following code
http://pastie.org/3661229
But that is using DynamicModel which does not provide any kind of autocompletion. It must be possible to do the same using the regular Model no?
It also seems that the above code causes my navigation children to be cached. When I uncheck the field "topNavigation" in the node, which comes from an inherit-only content-type, it doesn't refelct on my page when I refresh in a browser. It does however after a few minutes.
is working on a reply...