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
Hi new to umbraco 8
Not sure how to create a query which checks a property type.
Used to just use.
var footerNodes = CurrentPage.Site().Children.Where("footerNav == true");
to get a list of nodes where the property type footerNav is checked.
This is as far as I have got with the new umbraco... but its wrong.
var selection = Umbraco.ContentAtRoot().FirstOrDefault() .Children() .Where(x => (x.HasValue<bool>("footerNav") == 1)) .Where(x => x.IsVisible());
Anyone know how I solver this ?
Rob
Hi
Use this code:
var selection = Umbraco.ContentAtRoot().FirstOrDefault() .Children() .Where(x => x.Value<bool>("footerNav")) .Where(x => x.IsVisible());
Use "Value()" instead of "HasValue"
HasValue is checking for null and emptiness.
Thanks :) works a charm.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Help with property type in query
Hi new to umbraco 8
Not sure how to create a query which checks a property type.
Used to just use.
var footerNodes = CurrentPage.Site().Children.Where("footerNav == true");
to get a list of nodes where the property type footerNav is checked.
This is as far as I have got with the new umbraco... but its wrong.
Anyone know how I solver this ?
Rob
Hi
Use this code:
Use "Value()" instead of "HasValue"
HasValue is checking for null and emptiness.
Thanks :) works a charm.
Rob
is working on a reply...