Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Partial View Paths


I'm starting to get a handle on 7 with MVC.  Using the guide here (, I was able to set my directories up where I can keep all my Views in one folder if I want and not have use the default View/index.cshtml setup. It works fine for views, but partial views is another story. I have a path to ~/Views/Blocks/MyBlock.cshtml and it is ignored. If I put the same file in the ~/Views/Shared directory, CMS picks it up. Am I missing something or is there another way to say BlockType use the Partial View located here?

Dec 07, 2012 22:27

You can register your partial views with episerver by implementing interface EPiServer.Web.Mvc.IViewTemplateModelRegistrator. The implementation can look something like:

 new DataAbstraction.TemplateModel()
       Name = "PageTeaser",
       Description = "Displays a teaser of a page.",
       Path = "~/Views/Shared/PageTeaser.cshtml",
       Inherited = true


the above code registers a partial view for the modelclass PageData (in your case it should be your block model). Property Path is only nessecary if you do not follow naming conventions (so in case above Path could have been omitted).

Dec 11, 2012 14:42
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.