MVC4 Custom View Engine

I'm having trouble implementing the MVC4 Custom View Engine to override the default locations for partial views. I implemented the code in this example .

My problem is that before creating CreatePartialView an error occurs if the path does not match the value in the PartialViewLocationFormats array when starting / executing HTML.Partial. Nothing will match, since the goal of this implementation is to have dynamic paths. Any insight would be appreciated.

+4
source share
1 answer

Just put the path in your path, not the default, so MVC set partialPath from another source, for example, passing it for viewing from the controller or creating a search class.

return base.CreatePartialView(controllerContext, **partialPath** ); 
0
source

All Articles