Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Change view for different content areas

Vote:
 

Hi,

I want to be able to change the way a block is rendered depending on what ContentArea I put it in. It would be really cool to change the cshtml file I am using for different ContentAreas. I think something similar is present in the Alloy site but I am not sure. Can anyone tell me if this is possible and how?

I am using MVC4 with Razor, EPiServer 7.5 and .NET 4.5

Thank you very much!

#81537
Feb 19, 2014 8:24
Vote:
 
#81543
Edited, Feb 19, 2014 8:41
Vote:
 

I would suggest that you use a Tag where you decide to render your ContentArea, would that work for you?

#81545
Feb 19, 2014 8:54
Vote:
 

I agree with Alf, it sounds like you should use tags and template descriptors to solve this. You could take a look at TeaserBlock / TeaserBlockWide in the Alloy templates. You can bind a template to a tag either by registrating it at startup (take a look at TemplateCoordinator.cs in the Alloy project), or use a template descriptor: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/7/Content/Pages-and-Blocks/How-To/Selecting-a-Template-Based-on-Tag/

#81546
Feb 19, 2014 9:07
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.