Restriction of DisplayOptions tag not working



I am using multiple display options on my website and am trying to set up a block so that it only uses one of the display options. I have got the following display options set:

    public class SungardDisplayOptionsProvider : IDisplayOptionsProvider
        public const string FullWidthTag = "full";
        public const string OneHundredTag = "100";
        public const string SeventyTag = "70";

        public void InitializeOptions(EPiServer.Web.DisplayOptions options)
            .Add("full", "/displayoptions/full", FullWidthTag, string.Empty, "epi-icon__layout--full")
            .Add("onehundred", "/displayoptions/onehundred", OneHundredTag, string.Empty, "epi-icon__layout--full")
            .Add("seventy", "/displayoptions/seventy", SeventyTag, string.Empty, "epi-icon__layout--full")
            .Add("fifty", "/displayoptions/fifty", ContentAreaDisplayOptions.Fifty, string.Empty, "epi-icon__layout--one-third")
            .Add("thirty", "/displayoptions/thirty", ContentAreaDisplayOptions.Thirty, string.Empty, "epi-icon__layout--one-third")
            .Add("twentyfive", "/displayoptions/twentyfive", ContentAreaDisplayOptions.TwentyFive, string.Empty, "epi-icon__layout--quarter");


In my TemplateCoordinator I do the following:

        public void Register(TemplateModelCollection viewTemplateModelRegistrator)

            viewTemplateModelRegistrator.Add(typeof(CaseStudyFullWidthTextBlock), new TemplateModel
                Tags = new[] { SungardDisplayOptionsProvider.FullWidthTag },
                AvailableWithoutTag = false,
                Path = BlockPath("CaseStudyFullWidthText.cshtml"),

However, when I look at the CMS, I can see the following:

"The block 'Full width text block' cannot be displayed as /displayoptions/onehundred

The block 'Full width text block' cannot be displayed as /displayoptions/thirty

The block 'Full width text block' cannot be displayed as /displayoptions/seventy

The block 'Full width text block' cannot be displayed as /displayoptions/fifty

The block 'Full width text block' when displayed as /displayoptions/full

The 'CaseStudyFullWidthTextBlock' can not be displayed using the 'Full' display option

The block 'Full width text block' cannot be displayed as /displayoptions/twentyfive"

As you can see, it looks like it's trying to display the display option with the "full" tag as requested, but for some reason it can't. Even more strangely, If I set AvailableWithoutTag to true, all the views get rendered correctly for the block, including "full". This leads me to think there is a bug in episerver (I'm using version 9), but maybe i'm missing something?

Thanks for any help,


Dec 11, 2017 11:57

It looks correct according to the SDK. I've not tested the code myself though.

Spontenous answer Episerver support usually gives is "try to upgrade to a later version".

In case you don't have time to upgrade to 11, at least try to upgrade to latest version within Episerver 9 (NuGet Package). Or copy your code into an Alloy Website running the latest version of Epi.

For comparison I generally compare my code with the examples in Alloy or as I just mentioned copy my code into Alloy.

Edited, Dec 16, 2017 16:20

I wouldn't upgrade just yet.  i filed a bug with epi on the version 11 where it will add the first modeltype and 1 display option but omits the others.  The above code looks right though.  For some reason, worth a check, does it view exist in the right path?  BlockPath("xxxx.cshtml").  does the view exist?

Edited, Dec 17, 2017 17:31

@Joshua - yes the view does exist in the right path, and it renders correctly in the preview when I set AvailableWithoutTag = true.

@Alf - I'll try the upgrade and that's a good idea about using Alloy to test this functionality to see if it works in the latest version.

Jan 11, 2018 10:27

while I was writing these series of blog posts I came throught A LOT of stuff how that actually works, but it's a bit rusty now in my memory..

maybe you can find some answers there tho...

Jan 11, 2018 15:27

I can say this issue was fixed in a bug i filed.  I upgraded to the version it was fixed in and appears to be working now.  It would only register the first model and ignore the additional display options/tags. 

Jan 11, 2018 15:50

The bug was filed here.  CMS-9294

Edited, Jan 11, 2018 15:52
* 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.