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 All, I want to check if the property on a page equals a string value. I cant seem to get it to work with the strongly type partial.
Any help would be grateful.
Thanks
Martin
@foreach (var childPage in home.Children.Where(x => x.IsVisible())) { if (childPage.Children.Where(x => x.IsVisible()).Any() && childPage.Where(x => x.GetPropertyValue<string>("navigationDropdown").Equals("secondary")))
Hi Martin
What is "secondary"?
Can you check in /app_data/umbraco.config what is stored in "navigationDropdown" property?
/Alex
Hi Martin,
what kind of data type is your navigationDropdown property? I guess it contains a Array of strings and not only one string so the conversion to a string using x.GetPropertyValue<string>("navigationDropdown") fails.
navigationDropdown
x.GetPropertyValue<string>("navigationDropdown")
Hope this helps.
/Michaël
Hi Guys,
Thanks for replying.
The property "navigationDropdown" is a textbox data type. It's intended to determine what kind of dropdown style is applied to the child pages.
I want to check if the string matches "secondary" value.
Thanks again.
It looks you need something like that:
@foreach (var childPage in home.Children.Where(x => x.IsVisible() && x.GetPropertyValue<string>("navigationDropdown").Equals("secondary"))) { if (childPage.Children.Where(x => x.IsVisible()).Any()) { } }
Child pages that have child pages and "navigationDropdown" property value equals "secondary"?
Thanks,
Alex
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Conditional If - Check if property type has string value
Hi All, I want to check if the property on a page equals a string value. I cant seem to get it to work with the strongly type partial.
Any help would be grateful.
Thanks
Martin
Hi Martin
What is "secondary"?
Can you check in /app_data/umbraco.config what is stored in "navigationDropdown" property?
/Alex
Hi Martin,
what kind of data type is your
navigationDropdown
property? I guess it contains a Array of strings and not only one string so the conversion to a string usingx.GetPropertyValue<string>("navigationDropdown")
fails.Hope this helps.
/Michaël
Hi Guys,
Thanks for replying.
The property "navigationDropdown" is a textbox data type. It's intended to determine what kind of dropdown style is applied to the child pages.
I want to check if the string matches "secondary" value.
Thanks again.
Hi Martin
It looks you need something like that:
Child pages that have child pages and "navigationDropdown" property value equals "secondary"?
Thanks,
Alex
is working on a reply...