Copied to clipboard

Flag this post as spam?

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


  • Sam 26 posts 137 karma points c-trib
    Feb 21, 2016 @ 21:44
    Sam
    0

    Ignoring Property Value Converter

    Hello,

    I have added a property value converter into my project and it works great. However, some times I would like to get the raw string value, rather than the converted value.

    I thought .GetPropertyValue

    Anyone have any ideas?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2016 @ 07:43
    Jeroen Breuer
    0

    Hello,

    A Propery Value Converter is always executed. There is no way around it. In the converter you can decide what type to return. See this example: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Extensions/PropertyConverters/MultipleMediaPickerConverter.cs#L85

    Maybe you can do something with that?

    Jeroen

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 22, 2016 @ 08:02
    Jeavon Leopold
    104

    .GetProperty("my property").DataValue will get you the raw value

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 22, 2016 @ 08:22
    Ismail Mayat
    0

    Jeavon,

    Would the PropertyValueConvertor still fire and do conversion? I had this recently where I had mntp property with quite a few items picked I just wanted to check i had items forgot about HasValue and was trying to get actual data to see if i had anything.

    Regards

    Ismail

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 22, 2016 @ 08:27
    Jeavon Leopold
    2

    Yes, GetProperty("myThing").DataValue will always return the raw saved value while GetPropertyValue("myThing") will get the output of the value converter.

  • Sam 26 posts 137 karma points c-trib
    Feb 22, 2016 @ 20:30
    Sam
    0

    Perfect Jeavon! This does exactly what I wanted :)

    FWIW I will always want the converted value moving forwards but need the raw value for backwards compatibility, if anyone was curious.

Please Sign in or register to post replies

Write your reply to:

Draft