Try our conversational search powered by Generative AI!

problem implementing own custom Episerver forms element ( SelectionElementBlockBase with few more options)



I have small problem. 

im tryion to create my own 
    public class ChoiceElementBlock : SelectionElementBlockBase

but instead with own OptionItem

    public class CustomChoiceElementBlock : SelectionElementBlockBase


well the problem is it throws:

Type 'System.Collections.Generic.IEnumerable`1[[TestSolution.Core.Models.Forms.CustomOptionItem, TestSolution.Core, Version=, Culture=neutral, PublicKeyToken=null]]' could not be mapped to a PropertyDefinitionType

i tried to create my own SelectionElementBlockBase -> CustomSelectionElementBlockBase 

but the problem is with: 

[Display(GroupName = "Information", Order = -3000)]
public virtual IEnumerable Items { get; set; }

is does not like my new CustomOptionItem for some reason..

i tried to take the original OptionItem 

public class CustomOptionItem : IOptionItem

[Display(Order = 1000)]
public virtual string Caption { get; set; }

[Display(Order = 2000)]
[RegularExpression("([^,])*", ErrorMessage = "/episerver/forms/contentediting/optionitem/containsinvalidcharacter")]
public virtual string Value { get; set; }

[Display(Order = 3000)]
public virtual bool? Checked { get; set; }


but still cast same error :(

any idea?

what have i missed, tried to contact Episerver support but nobody answers for one week.. 

Many thanks in advance!



May 17, 2017 13:05

this blogpost pointed me in right direction to get rid of the error!

May 17, 2017 18:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.