November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
If the list should contain all categories defined in EPiServer you can remove the SelectOneAttribute from your property. This is the only thing you need:
[Display(Name = "Category Selection", Order = 1)] public virtual CategoryList Category { get; set; }
I'm trying to create an MVC block which will allow the user to select a category from all available categories to affect some programatically defined items. (IE Select 'shoes' to show some calculated shoe results, or 'TVs' etc etc)
In my block definition I have:
[Editable(true)]
[Display(Name = "Category Selection",
Order = 1)]
[SelectOne(SelectionFactoryType = typeof(CategorySelectionFactory))]
public virtual CategoryList Category { get; set; }
Which I was hoping would give me a select list of available categories for the user to choose from. However when I'm running the solution and going to the block I'm getting the following error:
Unable to cast object of type 'EPiServer.Business.Commerce.VisitorGroupsCriteria.CategorySelectionFactory' to type 'EPiServer.Shell.ObjectEditing.ISelectionFactory'
But from what I can see CategorySelectionFactory does implement ISelectionFactory, so I'm not sure what I'm missing here to cause this error. If I am meant to inject an instance of CategorySelectionFactory I'm not sure how to do that for an MVC block.
Sorry if this is a relatively basic question, I'm relatively new to EPiServer development, and any help would be appreciated.