Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

Custom content area display template won't work

Ted
Ted
Vote:
 

Hi!

I've added a new display template for content area properties, much like in the ASP.NET MVC Alloy templates.

The display template is located at /Views/Shared/DisplayTemplates/ContentArea.cshtml and contains the following code:

@model EPiServer.Core.ContentArea

@if(Model != null)
{
    // Custom rendering done here
    Html.RenderBalancedContentArea(Model);
}

 

However, content areas are still being rendered by the default display template that ships with EPiServer... :(

I'm going out of my mind a little bit over here, so any help is greatly appreciated!

Thanks!

#71810
May 29, 2013 19:53
Vote:
 

do you have other custom display templates that are working? Image for example

#71837
May 30, 2013 10:57
Ted
Vote:
 

We have one for Image, but that one's essentially for the Url type and the "Image" UI hint, so that's a bit different.

Since we're coming up on site launch we opted to add a UI hint to all content areas and renamed our display template accordingly. Now everything works as expected.

This should probably be registered as a bug?

Thanks for your help!

#71905
May 31, 2013 15:24
Vote:
 

I'm guessing you need to change the default priority of mvc views. By default, ascx/aspx views are prior to cshtml views in the mvc views list. Take a look at the CustomizedRenderingInitialization class in the alloy mvc templates.

#71914
May 31, 2013 16:31
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.