I would like to have both these views:
- ~/Views/Customer/Index.aspx
- ~/Views/Customer/Index.ascx
I would like to setup my MVC website so that when I call return View(viewModel)
from the CustomerController.Index()
action method, that it looks up the aspx file, but if I call return PartialView(viewModel)
that it looks up the ascx file.
I believe the magic involves subclassing ViewEngine
and ControllerFactory
(so that the ViewLocator.ViewLocationFormats
can be modified), but want to check that I'm not over-engineering this solution.
Does anyone have any experience with this?