Try our conversational search powered by Generative AI!

Cannot find CriterionPropertyEditor?



I'm trying to create my own criteria using this article:

But I cannot find any reference to CriterionPropertyEditor?

[CriterionPropertyEditor(SelectionFactoryType = typeof(MatchStringType))]

Gives me error that CriterionPropertyEditor cannot be found are you missing reference? I what namespace is CriterionPropertyEditor located?



Apr 07, 2022 16:46

Hmmm..... Looking here:

Should it be "CriterionPropertyEditorAttribute" (in the namespace EPiServer.Personalization.VisitorGroups) instead of "CriterionPropertyEditor"?

Apr 07, 2022 22:25


The CriterionPropertyEditor attribute is new to CMS 12 so, if the 11.20.x tag you've added is correct and you're working on v11, you don't need that attribute. The documentation for v11 is here: 

Apr 08, 2022 8:15

Thanks Paul!

Apr 08, 2022 8:18

No problem.

For the sake of future-proofing the answer, I should point out that the newer version of that documentation for v11 can be found here: 

Apr 08, 2022 8:32

Hmm, doing this:

[DojoWidget(WidgetType = "dijit.form.FilteringSelect", SelectionFactoryType = typeof(EnumSelectionFactory<MatchStringType>))]
public MatchStringType MatchType { get; set; }

gives me this:

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Personalization.VisitorGroups.DojoHtmlExtensions.DojoDropDownFor(HtmlHelper`1 html, PropertyInfo p, Object htmlAttributes, String label, String labelCssClass, LabelPosition labelPosition, DojoWidgetAttribute attr) +112
   EPiServer.Personalization.VisitorGroups.DojoHtmlExtensions.DojoEditorFor(HtmlHelper`1 html, PropertyInfo propertyInfo, Object htmlAttributes, String label, String labelCssClass, LabelPosition labelPosition) +224
   ASP.episerver_cms_views_shared_editortemplates_object_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:\Projekt\Direktronik\\Direktronik.Web\episerver\CMS\Views\Shared\EditorTemplates\Object.ascx:38
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +116
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +131
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +270
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +74
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +9530


public class EnumSelectionFactory<TEnum> : ISelectionFactory
        public IEnumerable<ISelectItem> GetSelections(
            ExtendedMetadata metadata)
            var values = Enum.GetValues(typeof(TEnum));
            foreach (var value in values)
                yield return new SelectItem
                    Text = this.GetValueName(value),
                    Value = value 

        private string GetValueName(object value)
            var staticName = Enum.GetName(typeof(TEnum), value);

            if (staticName != null)
                string localizationPath = string.Format(

                string localizedName;
                if (LocalizationService.Current.TryGetString(
                    out localizedName))
                    return localizedName;

            return staticName;

Any ideas?


Apr 08, 2022 8:41

Found the answer here!

Apr 08, 2022 9:08

Unless you're doing something special, you shouldn't need to create a new EnumSelectionFactory as there's already one ready-to-use in EPiServer.Web.Mvc.VisitorGroups.EnumSelectionFactory.

Apr 08, 2022 9:31
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.