Try our conversational search powered by Generative AI!

custom property - dropdown list

Vote:
 

Hi, 

I created a custom property using the code : http://www.frederikvig.com/2010/05/episerver-custom-property-with-custom-settings/

like this 

[PageTypeProperty(
Type = typeof(PropertyDropdownCheckList),
EditCaption = "Select Roles",
SortOrder = 23,
HelpText = "Selected label will be display on news items")]
public virtual PropertyDropdownCheckList SelectedRoles { get; set; }

 

when I am trying to access, selected items in the above dropdown. I am getting error -  unable to cast system.string to Dropdownchecklist

 

any help would be appreciated !!

#72460
Jun 17, 2013 23:05
Vote:
 

The property is supposed to be public virtual string SelectedRoles { get; set; }

and you add this attribute to specify your custom property:

[PageTypeProperty(Type=typeof(PropertDropDownCheckList))]

read more on http://joelabrahamsson.com/developing-with-page-type-builder-inheritance-and-specifying-property-types/

#72461
Edited, Jun 18, 2013 0:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.