Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Cannot override the template of ContentArea


I am trying to change the way a ContentArea is rendered. I call Html.PropertyFor() with a specific tag, which is registered with IViewTemplateModelRegistrator to render a custom partial view. However, I cannot get this to work (it works with custom blocks, though). If I create /Views/Shared/DisplayTemplates/ContentArea.cshtml, it works. But I don't want to change the default view there, but rather create my own. Has anyone experienced this? :)

Aug 03, 2015 16:49


Are you willing to override content area display template or the way how blocks would be rendered inside conten area using tag? `Tag` has very special meaning for the content areas and its rendering pipeline. You can take a look at registration process blog posttemplate selection blog post or extending the content area. Maybe one of those could give you some clue why stuff is not working in your case.

Aug 03, 2015 20:50

Valdis made a great serie of blog posts on how this works.

Here you can read (down right now it seems, but hopefully works later) about the templeresolver part

Aug 03, 2015 20:52

Basically what I want to do is to change the default ContentAreaRenderer but only for one specific ContentArea. My logic was to tag the PropertyFor and just to define a custom template for that area. I could alternatively do it manually, but calling Html.RenderMyCustomContentArea(), but I think that using PropertyFor() is the preferable way.

I will check the blogs now :-)

Aug 04, 2015 9:04

Using `Tag` in `PropertyFor()` will not be effective as `Tag` comes up on the stage later - when template selection process begins for the content area items. Renderer for the content area is singleton.

Aug 04, 2015 11:54

This worked perfectly for us. Thanks

Aug 05, 2015 10:57
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.