Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Multiple tags on block



I have a block for listing of links that is used on various places on the website.

On one page type I have a content area in which I want to display the link list block but render a special view.

So I tag the block controller:

[TemplateDescriptor(Tags = new[] { "SomeTag" }, AvailableWithoutTag = false, Inherited = false)]
	public class RelatedLinkList : BlockController<LinkListBlock>

And set a tag on the content area:

@section relatedDocuments
    @Html.PropertyFor(x => x.CurrentPage.RelatedDocumentsArea, new {Tag="SomeTag"})

However, this only works if the Display Options for the block is set to "Automatic", otherwise the block is rendered in the default view.

I want to be able to set Display Options (width) and use the special view for the block, how is this possible?

Thanks for helping.

Feb 24, 2014 11:10

As you have noticed when you select a Display Option then that selection will take preference before the tag. There is a class EPiServer.Web.Mvc.Html.ContentAreaRenderer that handles this. The method GetContentAreaItemTemplateTag is the one that does this. You could inherit the class and override that method to change the behaviour. You would then need to register your implementation in the IOC container.

Feb 24, 2014 14:35

Thank you for the fast reply.

Your solution was spot on and with a few easy modifications it works like a charm. Much appreciated,


Feb 25, 2014 10:48
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.