Try our conversational search powered by Generative AI!

Display attribute ignored for group definitions for pages or blocks


I created a custom group name that I wanted some of my page types to be listed under when creating new instances. This seems to work great when the name of the group is only a single word, but friendly names with spaces are ignored. Here is an example of my group definition:

        public static class ContentGroupNames
            [Display(Name = "Custom Pages", Order = 70)]
            public const string CustomPages = "CustomPages";

At run time the name of the group shows the constant name "CustomPages", rather than the friendly name with the space from the Display attribute. These work just fine for tabs within content, but not for page or block group names. 

Jun 10, 2019 17:55

Hi Jason,

It's using the string value, so you could update it to:

public static class ContentGroupNames
    [Display(Order = 70)]
    public const string CustomPages = "Custom Pages";

and it will work.

Or, if you need localization, then add the following to the language XMLs:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <language name="English" id="en">
            <custompages>Custom Pages</custompages>
Jun 10, 2019 19:36

So am I forced to use the constant value as the display value? Is the Display attribute ignored all together?

Jun 10, 2019 22:06

Hi again,

Noyou're not actually forced to use the string value, ideally you'd use the XML approach. That's the Episerver reccomendation as per the documentation (see 'Localizing headers'):

After a quick peek in the code I can't see that it ever uses the DisplayAttribute Name when using group definitions, but maybe I'm missing something.

Jun 10, 2019 22:41
* 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.