Try our conversational search powered by Generative AI!

Change view for different content areas



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!

Feb 19, 2014 8:24
Edited, Feb 19, 2014 8:41

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

Feb 19, 2014 8:54

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:

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.