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
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!
Hi Warren,
If you include a using for Umbraco.Cms.Core.PropertyEditors, you should be able to get it to work.
Hope that helps!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Retreiving Dropdown Data Type Options
Hi there, could anyone please advise how to pull in the prevalue options from a data type in v9?
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
So DataTypeService.GetDataType appears to be working correctly, but now I'm stuck.
Thanks all!
Hi Warren,
If you include a using for Umbraco.Cms.Core.PropertyEditors, you should be able to get it to work.
Hope that helps!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.