I bet you could using one or more of the DataTypeService. However you'll then be hitting the database, so if you're looking to do this on a page view I would find another route.
@if (Model.HasValue("yourColorPickerProperty"))
{
@* Include this after @inherits Umbraco.Web.Mvc.UmbracoViewPage on your Partial View *@
@* @using Umbraco.Core.PropertyEditors.ValueConverters; *@
var Colour = "#" + Model.Value<ColorPickerValueConverter.PickedColor>("yourColorPickerProperty");
var Label = Model.Value<ColorPickerValueConverter.PickedColor>("yourColorPickerProperty").Label;
<p style="color: @Colour">
The colour is @Label
</p>
}
Color Picker - Return Label Value
Hi All,
Is it possible to return the Color Picker label value?
Thanks
Martin
I bet you could using one or more of the DataTypeService. However you'll then be hitting the database, so if you're looking to do this on a page view I would find another route.
Martin, peace be upon those who follow guidance. I was able to get the label of selected value by using the following code.
Preview:
This will work for Umbraco 8
is working on a reply...