Custom EPiServer key value property.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
JOS.PropertyKeyValueList.Ui Support for episerver 11 Nov 25, 2017


Custom EPiServer key value list property with support for predefined keys.

Install it by simply running Install-Package JOS.PropertyKeyValueList.Ui in the Package manager console.

Inspired by this blogpost by Peter Löfman where he had done something quite similar to what I wanted to achieve so I used his blog post to get started.

The property has two "modes", ReadOnlyKeys or Normal.


Add the property like this to try it out.

public virtual IEnumerable<KeyValueItem> ReadOnly { get; set; }

ReadOnlyMode is specified by passing in an IReadOnlyKeysProvider to the constructor of the KeyValueAttribute.


public interface IReadOnlyKeysProvider
    List<string> GetKeys();

My implementation in this example looks like this: ReadOnlyKeysProvider

public class ReadOnlyKeysProvider : IReadOnlyKeysProvider
    public List<string> GetKeys()
        return new List<string>()
            "Real Madrid",
            "Skara FC",
            "Axvalls IF",
            "IFK Göteborg",
            "Djurgårdens IF",

When specifying a IReadOnlyKeysProvider the property will render in ReadOnlyKeysMode and look like this: Property rendered in readOnlyKeysMode The editor will only be able to edit the "value" portion of the property, not the predefined keys. It's not possible to add new items in this mode.


Add the property like this to try it out.

public virtual IEnumerable<KeyValueItem> NotReadOnly { get; set; }

The property will look like this in edit mode: Property rendered in normal mode Currently it's possible to add as many items as you like but Im thinking of adding an optional MaxLimit.