This project is read-only.

Shared views in modules

Topics: Troubleshooting, Writing modules
Jun 7, 2012 at 5:47 PM

I am trying to migrate an existing ASP.NET MVC application to an Orchard module. This application used shared views (in folder Views/Shared). So I moved these views to a respective folder under my Module's views. However, the framework cannot find these views.

Has anyone tried shared views in an Orchard module?



Jun 8, 2012 at 6:59 AM

What are shared views?

Jun 8, 2012 at 7:58 AM

I mean partial views, that are shared among multiple controllers, and which are placed in folder Views/Shared.

Jun 8, 2012 at 8:20 AM

There's nothing special about those. How exactly do they not work for you?

Jun 8, 2012 at 8:28 AM

The servers returns an error about view not found, and lists all possible folders and adding different extensions (cshtml, aspx, ascx) to the view name, where it searched for the view, but this list does not include folder MyModuleName/Views/Shared/. When I move the partial view from MyModuleName/Views/Shared/ to MyModuleName/Views/MyController/, it works fine, but other controllers don't see it there of course. So I have to copy the view to all controller's view folders.

Jun 8, 2012 at 8:35 AM

Well, of course, I don't want you to waste time on troubleshooting my problem, just wanted to get a confirmation that it should work in Orchard, and someone has already successfully used shared views. Then, I'll be assured the problem is in my own environment and will look further for the problem myself.

So if you say that it should work in Orchard the same way as in an ordinary MVC application, that's enough for me.

Jun 8, 2012 at 9:05 AM

Did you try to put your view directly under Views?

Jun 9, 2012 at 12:14 AM

Yes, placing shared views directly under Views did the trick. Thank you!

Sep 5, 2012 at 1:49 PM

Dear all,

Just wondering if there is a way to add /Shared/, /Shared/DisplayTemplates, etc. into the search path?

Best regards,


Sep 12, 2012 at 11:07 PM