I have an XXX.cshtml
file in a Views\ABC
folder. Its controller is ABC
I also have an action method in my DEF
controller that return a Partialview("XXX" , xyzmodel)
I get a "view not found" error.
How to call that view from other controller
This question is related to
c#
asp.net-mvc
The control searches for a view in the following order:
As you do not have xxx.cshtml
in those locations, it returns a "view not found" error.
Solution: You can use the complete path of your view:
Like
PartialView("~/views/ABC/XXX.cshtml", zyxmodel);
Simply you could use:
PartialView("../ABC/XXX")
Source: Stackoverflow.com