SaaS CMS has officially launched! Learn more now.

Default renderer


I have a ContentArea that pages can be added to and rather than creating a separate render for each type using a .cshtml I want one for the base class it's inherited from. I've tried generic controllers, overiding the editor and faking it and other techniques but I can't get it working.

Nov 14, 2013 11:39

I have made this working by creating one View where model is basetype and then register this view in a InitializableModule that implements IViewTemplateModelRegistrator.

public void Register(TemplateModelCollection viewTemplateModelRegistrator)
                new EPiServer.DataAbstraction.TemplateModel()
                    Name = "PageTeaser",
                    Description = "Displays a teaser of a page.",
                    Path = "~/Views/Shared/_PageTeaser.cshtml",
                    Inherited = true


Nov 14, 2013 11:56

Thanks Mari, I've just got this way working myself as well using the EpiServer MVC template as an example. I love this approach because of the ability to pass tags in so you can control which is used. I'll mark this as accepted as this is the best approach I've found

Nov 14, 2013 15:21
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.