Try our conversational search powered by Generative AI!

Displaying a dropdown in the edit interface of a Dynamic Content plugin


For a standard pagetype, we can decorate a property the the EditorDescriptor-attribute to specify that a dropdown should be displayed, and a selection factory (implementing ISelectionFactory) to specify the valid values for the dropdown. This works like a charm.

The challenge: Now I have a Dynamic Content plugin, and I would like the same type of dropdown property to be displayed in the edit interface that is automatically generated by EPiServer (since the other properties on the plugin are simple types).

I have tried decorating the property with the SelectMany-attribute, and specifying the same selection factory for the SelectionFactoryType, but this does not produce a dropdown. Only a standard textbox is displayed.

The question: Is it possible to have the dropdown be generated automatically, or do I have to create a usercontrol for the edit interface, and create and populate the dropdown list myself, manually?

PS: I had this working automagically for EPiServer 6R2, by letting the property return a custom type that I had created. The custom type derived from PropertyDropDownList and was decorated with the PageDefinitionTypePlugIn-attribuyte, as well as a custom attribute that implemented PageTypeBuilders IUpdatePropertySettings<MultipleOptionsListSettings>. It was this custom attribute that was responsible for populating the options in the dropdown list.

Feb 07, 2014 10:44

Unfortunately, the Dynamic Content and Dynamic Properties are still using the legacy editing system. You should be able to define a collection of properties to be edited in your dynamic content. Then you have to create a custom property and a custom property control (The EPiServer 6 way). The control can inherit from PropertySelectControlBase, override the SetupEditControls method and add items to the EditControl DropDownList.

Feb 07, 2014 11:56

Thank you Linus, the approach you suggested works fine.

A tiny detail is that when the edit view is rendered, the label in front of the control takes way too much space. I'm not sure how to load a custom CSS-file to override the styles used by EPiServer in this view, since the stylesheet defined with the attribute "uiEditorCssPaths" appears not to be loaded for this view. Any suggestions?

I'm also pretty stuck on the related issue, how to select a file in the edit interface. Any input here would be very much appreciated:

Feb 14, 2014 14:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.