Hi there, could anyone please advise how to pull in the prevalue options from a data type in v9?
List<SelectListItem> listItems = new List<SelectListItem>();
IDataTypeService dataTypeService = Current.Services.DataTypeService;
var dataType = dataTypeService.GetDataType(DataTypeName);
ValueListConfiguration prevalues = (ValueListConfiguration)dataType.Configuration;
foreach (ValueListConfiguration.ValueListItem item in prevalues.Items)
{
listItems.Add(new SelectListItem { Value = item.Value, Text = item.Value, Selected = (ModelComparer == item.Value) });
}
I can’t seem to get an ValueListConfiguration any longer in 9 as Umbraco.Core.PropertyEditors no longer exists?
I’m trying to get this in a razor view, and have added
@inject IDataTypeService DataTypeService
So DataTypeService.GetDataType appears to be working correctly, but now I’m stuck.
Thanks all!
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/108464-retreiving-dropdown-data-type-options