Using PropertyDropDownList with EPiServer Dynamic Content

I’m creating a “widget” where the client is supposed to be able to change color to a Teaser. The color options should be editable quite easily.

The widget is added to the page by using Dynamic Content.
So I’m using the PropertyDropDownList added in EPiServer CMS 6 R2 so an administrator can edit the options through the Administrator Mode (or when PagetTypeBuilder 2 comes, a developer by creating a class deriving from IUpdateGlobalPropertySettings<MultipleOptionsListSettings>).

But since all ways to change the Property’s Settings values are locked from external binaries, I couldn’t find any other way to connect my Global Setting to the DropDownList in my Dynamic Content except creating a Custom Property that derives from PropertyDropDownList.

After that I create a Global Setting for DropDownList with some colors which I set as default for my PropertyTeaserColorDropDownList.

So by adding a Property of type PropertyTeaserColorDropDownList in my Dynamic Content class, I can let my Editor select a color from a list managed by the Administrator.

Code examples

public class PropertyTeaserColorDropDownList : PropertyDropDownList
{
}

[DynamicContentPlugIn(DisplayName = "Front Teaser", ViewUrl = "~/Widgets/FrontTeaserWidget/FrontTeaserWidget.ascx")]
public partial class FrontTeaserWidgetControl : WidgetControlBase
{
    public PropertyTeaserColorDropDownList TeaserColor { get; set; }
}

It feels a bit cumbersome to create a Custom Property for this. It would be nice if I could set the SettingsId somehow or if it could be set by some attribute.

One thought on “Using PropertyDropDownList with EPiServer Dynamic Content

  1. Ah… now I understand the problem. Tricky… internal setter is hard to get around

Leave a comment