i m trying to add a check for a boolean value in my code.
this works ok
var widgets = currentPage.Children.Where(x => x.DocumentTypeAlias == "widgetFolder").First().Children;
but now that i need to put these widgets in 2 separate areas of the page i added a new property (is WidgetInTheBanner) which is a True/False field.....
When i try
var widgets = currentPage.Children.Where(x => x.DocumentTypeAlias == "widgetFolder" && !x.GetPropertyValue<bool>("isWidgetInTheBanner")).First().Children;
i get an error - Sequence contains no elements - so i presume this statement is incorrect format....
checking for a boolean value
i m trying to add a check for a boolean value in my code.
this works ok
var widgets = currentPage.Children.Where(x => x.DocumentTypeAlias == "widgetFolder").First().Children;
but now that i need to put these widgets in 2 separate areas of the page i added a new property (is WidgetInTheBanner) which is a True/False field.....
When i try
var widgets = currentPage.Children.Where(x => x.DocumentTypeAlias == "widgetFolder" && !x.GetPropertyValue<bool>("isWidgetInTheBanner")).First().Children;
i get an error - Sequence contains no elements - so i presume this statement is incorrect format....
Not really a format error but First is not getting anything, to make it more resilient, try this:
thanks
it still doesnt seem to be recognising the boolean value, some items ive set to true are still appearing....
sorry I changed your currentPage to Model.Content to test
is working on a reply...