Reputation: 35973
I would like to modify the ASP MVC default view name associated to a controller action method.
Here is my Controller
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
As the View() method called without viewName parameter the MVC framwork will look for the view Views/Home/Index.cshtml (and similars)
What I would like to achieve is to look for Views/ThemeA/Home/Index.cshtml or Views/ThemeB/Home/Index.cshtml depending on a global setting.
Please do not recommend me to pass the view name as parameter. The whole point is to be transparent to the Controllers.
Thx in advance
Upvotes: 1
Views: 1507
Reputation: 912
Write you own ViewEngine:
http://theshravan.net/blog/configure-the-views-search-locations-in-asp-net-mvc/
Don´tbe scared, just inherit from the standard engine and extend the search locations...
Upvotes: 1