Changing the Default View Engine's view search behavior.
Posted
by bradhe
on Stack Overflow
See other posts from Stack Overflow
or by bradhe
Published on 2010-04-29T19:14:09Z
Indexed on
2010/04/29
19:17 UTC
Read the original article
Hit count: 366
asp.net-mvc-2
|c#
I'm working with ASP.NET MVC 2. I have a bunch of partial views that I render based on different conditions within the same controller. I'd like to not put the physical partial view files in with the controller's other views.
I know that when I want a ViewResult using the View() or PartialView() methods the default view engine will search through the folder in the Views directory associated with the controller (i.e. if my controller is called Register it will look in the Register folder under Views) and also in the Shared folder.
Is there any way to change this behavior, or perhaps tell it specifically where to look for the view -- heck, even give it a specific file to render? Is that possible? Perhaps even a sub-folder under the Shared folder will work...
© Stack Overflow or respective owner