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
I'm running 7.15.4, and I have ColorPicker property that returns JSON
{ "label": "White", "value": "ffffff" }
According to the documentation Model.PropertyName should return the hexValue, but in this case I just get the JSON.
Model.PropertyName
Is there a workaround ?
Documentation: https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Color-Picker/
Hi Sebastian
There are a few inconsistencies with the colour picker and the last few releases of Umbraco 7...
I had similar difficulties ended up with this
// var textColour = slide.HasValue("textColour") ? slide.GetPropertyValue<ColorPickerValueConverter.PickedColor>("textColour") : default(ColorPickerValueConverter.PickedColor); var textColourRaw = slide.GetPropertyValue<string>("textColour"); var textColour = !String.IsNullOrEmpty(textColourRaw) ? JsonConvert.DeserializeObject<JObject>(textColourRaw) : default(JObject); var textColourClass = "text-white"; if (textColour != null && textColour["label"].ToString() != "White") { textColourClass = "text-carousel-" + textColour["label"].ToString().ToUrlSegment(); }
But that was in 7.14
The commented out line that uses the property value converter may just work in 7.15
Regards
Marc
That's excellent Marc, it put me in the right direction and solved my problem.
I still couldn't use the property value converter, but I might have tried the wrong way :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
ColorPicker returns JSON in Razor template
I'm running 7.15.4, and I have ColorPicker property that returns JSON
According to the documentation
Model.PropertyName
should return the hexValue, but in this case I just get the JSON.Is there a workaround ?
Documentation: https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Color-Picker/
Hi Sebastian
There are a few inconsistencies with the colour picker and the last few releases of Umbraco 7...
I had similar difficulties ended up with this
But that was in 7.14
The commented out line that uses the property value converter may just work in 7.15
Regards
Marc
That's excellent Marc, it put me in the right direction and solved my problem.
I still couldn't use the property value converter, but I might have tried the wrong way :)
is working on a reply...