Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Engan 430 posts 1173 karma points
    Dec 04, 2017 @ 17:11
    Tom Engan
    0

    IPublishedContent.GetPropertyValue<string> different versions?

    IEnumerable<IPublishedContent> pages = UmbracoHelper.TypedContent(NodeId)
        .Descendants()
        .Where(x => x.IsVisible() && x.DocumentTypeAlias.Equals("TextPage"))                   /* umbracoNaviHide = False, Document Type name */
        .Where(x => x.GetPropertyValue<string>("activityType").Equals("Fotturer"))             /* Property name (of a Document Type), Property value */
        .Where(x => !String.IsNullOrWhiteSpace(x.GetPropertyValue<string>("turListerCode")));  /* Property name, Property value not null or white space */
    

    This works in Umbraco version 7.7.6, but get an error in Umbraco version 7.3.1 in .Where(x => x.GetPropertyValue<string>("activityType").Equals("Fotturer")) Note that activityType is a data type of dropdown list, and !String.IsNullOrWhiteSpace or !String.IsNullOrEmpty doesn't work like in property value turListerCode below (which is a Umbraco.Textbox).

    Anyone who knows why the two different versions behave differently?

    And what can I do to eliminate errors in Umbraco version 7.7.6 when GetPropertyValue

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Dec 04, 2017 @ 17:15
    Alex Skrypnyk
    0

    Hi Tom

    Are you working with enabled property Value Converters or disabled in version 7.7.6?

    Alex

  • Tom Engan 430 posts 1173 karma points
    Dec 05, 2017 @ 14:26
    Tom Engan
    0
    .Where(x => x.GetPropertyValue<string>("activityType").Equals("Fotturer"))
    

    In umbracoSettings.config Umbraco version 7.7.6 I'v added these settings below.

    Umbraco version 7.3.1 didn't recognized these settings (where I've got an error if none value, the default, is choosen). It works as it should otherwise, just not when empty value is selected. How can I remove this error (see abowe)?

    <!-- For LeBlender: Set to false! Activate obsolete Media picker, Content picker, Member picker -->
    <!-- Enables value converters for all built in property editors so that they return strongly typed object, recommended for use with Models Builder -->
    <EnablePropertyValueConverters>false</EnablePropertyValueConverters>
    
    <!-- For LeBlender: Set to true! Activate obsolete Media picker, Content picker, Member picker -->
    <showDeprecatedPropertyEditors>true</showDeprecatedPropertyEditors>
    
Please Sign in or register to post replies

Write your reply to:

Draft