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.
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.
Yes, GetProperty("myThing").DataValue will always return the raw saved value while GetPropertyValue("myThing") will get the output of the value converter.
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?
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
.GetProperty("my property").DataValue will get you the raw value
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
Yes, GetProperty("myThing").DataValue will always return the raw saved value while GetPropertyValue("myThing") will get the output of the value converter.
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.
is working on a reply...