See example below. This will show a drop down list with three values.
You could also read these blogposts.
http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/9/EPiServer-7-Configuring-editors-for-your-properties/
http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2013/12/SingleMultiple-selection-in-EPiServer-75/
[Display(Order = 159)]
[UIHint("LocalityType")]
public virtual string LocalityType { get; set; }
[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "LocalityType")]
private class LocalityDropdownEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
SelectionFactoryType = typeof(LocalitySelectionFactory);
ClientEditingClass = "epi-cms/contentediting/editors/SelectionEditor";
base.ModifyMetadata(metadata, attributes);
}
}
public class LocalitySelectionFactory : ISelectionFactory
{
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
{
var localities = new List<SelectItem>();
localities.Add(new SelectItem() { Value = "1", Text = "Huvudkontor" });
localities.Add(new SelectItem() { Value = "2", Text = "Kontor" });
localities.Add(new SelectItem() { Value = "3", Text = "Övrig verksamhet" });
return localities;
}
}
Hi
Our solution is upgraded to EpiServer 7.5 recently and the custom PropertyData types are no longer functioning like before.
We have a page property defined as follows with it's BakingType is set to a custom PropertyData class called SelectClubUserProperty which extends EPiServer.Core.PropertyString.
In the SelectClubUserProperty class we have override the EPiServer.Core.IPropertyControl CreatePropertyControl() method to return a DropDownList of users.
This custom PropertyData type and the page property is linked by BackingType annotation. Under the page properties in the page edit mode this shows the drop down list of users. But after 7.5 upgrade it is just a plain text field.