November Happy Hour will be moved to Thursday December 5th.

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

Vote:
 

Hi,

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=1.0.0.0, 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)]
[UIHint("OptionList")]
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
{

[DisplayName("/episerver/forms/contentediting/optionitem/caption")]
[Display(Order = 1000)]
public virtual string Caption { get; set; }

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

[DisplayName("/episerver/forms/contentediting/optionitem/checked")]
[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!

//Pawel

 

#178671
May 17, 2017 13:05
Vote:
 

this blogpost pointed me in right direction to get rid of the error! 
http://jondjones.com/learn-episerver-cms/episerver-developers-guide/episerver-properties/episerver-how-to-render-a-list-of-objects-in-a-page-or-block-propertylist-explained

#178682
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.