metaBeskrivelse is a string I have on an inheritence-only content-type called settings. All actual pages in my Umbraco installation inherit from this type.
Have you tried with title-casing? 'MetaBeskrivelse'
I'm not sure it will ever equate to 'null' if the property actually exists (I could be wrong, though) but rather an empty string, as in your last example.
Now I have and without luck. In addition I can tell you that another property from the same inheritence-only type can be queried without problems with the following code.
@{ var root = @DynamicModel.AncestorsOrSelf.Last(); var topNavigation = @root.DescendantsOrSelf.Where("topNavigation = @0", "True"); } @{ if (topNavigation.Any()) { <ul id="navigation"> @foreach (var page in topNavigation) { <li><a href="@page.NiceUrl" class="ajax">@page.Name</a></li> } </ul> } }
So as we discussed elswhere, DynamicModel._metaBeskrivelse should do the trick, right? Cf. the DynamicModel._propertyAlias syntax for recursive property fetching. Does that return a boolean value for the if-test by itself?
Yes so we have a temporary solution. Though this solves the problem to some extent, we still don't have the flexibility with Where() that Xpath used to provide. It would be really nice if someone who's actually involved in working on Umbraco 5, could provide us with an explanation of why the initial approach fails and how we're able to achieve the desired flexibility.
DynamicModel.AncestorsOrSelf.Where("metaBeskrivelse != @0", "null")
Why does the following not work
I've also tried these other syntaxes
niether of which work. Please someone help me out here.
metaBeskrivelse is a string I have on an inheritence-only content-type called settings. All actual pages in my Umbraco installation inherit from this type.
Have you tried with title-casing? 'MetaBeskrivelse'
I'm not sure it will ever equate to 'null' if the property actually exists (I could be wrong, though) but rather an empty string, as in your last example.
Now I have and without luck. In addition I can tell you that another property from the same inheritence-only type can be queried without problems with the following code.
So as we discussed elswhere,
DynamicModel._metaBeskrivelse
should do the trick, right? Cf. the DynamicModel._propertyAlias syntax for recursive property fetching. Does that return a boolean value for the if-test by itself?Yes so we have a temporary solution. Though this solves the problem to some extent, we still don't have the flexibility with
Where()
that Xpath used to provide. It would be really nice if someone who's actually involved in working on Umbraco 5, could provide us with an explanation of why the initial approach fails and how we're able to achieve the desired flexibility.The working code is as follows.
Hi there Rasmus, have you tried 5.0.1 (released) or the beta of 5.1? The following syntaxes have passing tests in those builds
However, the code you have now is perfectly correct too, so if it's working for you, there's no rush to change
Forgot to mention - the 5.0.1 and 5.1 beta builds are available from http://umbraco.codeplex.com
is working on a reply...