Cannot override the template of ContentArea

Vote:
 

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? :)

#131700
Aug 03, 2015 16:49
Vote:
 

Hi,

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.

#131704
Aug 03, 2015 20:50
Vote:
 

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

http://blog.tech-fellow.net/2015/05/30/content-area-under-the-hood-part-2/

#131705
Aug 03, 2015 20:52
Vote:
 

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 :-)

#131716
Aug 04, 2015 9:04
Vote:
 

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.

#131726
Aug 04, 2015 11:54
Vote:
 

This worked perfectly for us. Thanks

#131782
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.