Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
http://stackoverflow.com/questions/32185447/how-do-you-support-selecting-multiple-enum-values-for-an-episerver-property
I ran into this issue today, and my problem was also the underlying Value type of the SelectItem. It looks like the Value needs to be a string.
Given you have a property that is a SelectMany:
[SelectMany(SelectionFactoryType = typeof(ChildPagesSelectionFactory))] public virtual string ChildPages { get; set; }
A common custom ISelectionFactory could be to return a list of child pages:
public class ChildPagesSelectionFactory : ISelectionFactory { private Injected<IContentLoader> _contentLoader; public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata) { var contents = _contentLoader.Service.GetChildren<IContent>(ContentReference.StartPage); return contents.Select(content => new SelectItem { Text = content.Name, Value = content.ContentLink.ID }); } }
This code would cause the issue you described, since the Value is of type int.
To solve this, cast the Value to a string:
public class ChildPagesSelectionFactory : ISelectionFactory { private Injected<IContentLoader> _contentLoader; public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata) { var contents = _contentLoader.Service.GetChildren<IContent>(ContentReference.StartPage); return contents.Select(content => new SelectItem { Text = content.Name, Value = content.ContentLink.ID.ToString() }); } }
This issue was reproduced and tested in Alloy MVC running CMS 9.8.3.
This is not an issue if you are using a SelectOne property.
I have a support ticket opened for this. Hopefully it'll be marked as a bug and fixed.
Hi,
I have created a group of checkboxes wich the editors can check if wanted. My problem is that when a editor checkes for example:
Does anyone know what I h ave missed or what I can do so that it in EPiServer shows the right status of the checkboxes?
I'm using the SelectMany attribute of EPiServer on my property holding the check boxes.