November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
But doesn't that solution only allow the editor to choose which value that the property of the enum holds?
I.e the editor can choose if the property should be Low, Normal, High. It doesn't provide the editor with a way to set the text for Low, Normal, High?
Not built in but you might use two properties that depends on each others, like they do in this example (but you will have an ordinary enum dropdown and then a simple textbox property and then you build it togheter in your viewmodel)
You could have a page type with 2 properties:
1. Dropdown with enum values
2. Text field with friendly name
Then add one page each per option (and language). Then build logic to get friendly name by searching these pages by value...
Add a container page to make it easy to create new options...(restricted to the pagetype above)
A bit old style but works :)
Hi,
Thanks for the help. Just wanted to tell you what I ended up doing:
I used this library: https://github.com/joseftw/JOS.PropertyKeyValueList and modified the KeyValueAttribute like
[AttributeUsage(AttributeTargets.Property)] public class EnumNameValueAttribute : Attribute { public List<string> ReadOnlyKeys; public EnumNameValueAttribute() { this.ReadOnlyKeys = new List<string>(); } public EnumNameValueAttribute(Type enumType) { this.ReadOnlyKeys = Enum.GetNames(enumType).ToList(); } }
This enables the editor to set texts on the Enum.
Hi!
I have a C# enum:
public enum Priority
{
Low= 0,
Normal= 1,
High = 2
}
I would like an editor to be able to associate a text to the enum values like Low => "This is the lowest priority"
Is there a Epi Server property for this?