我有以下控制器代码:
public MyController:Controller { public ActionResult Index() { return View(); } [ChildActionOnly] public ActionResult MyPartialViewAction() { return PartialView("~/Views/Shared/MyCustomFolder/_MyPartialView",Partialviewmodel); } }
我的索引视图具有以下代码:
@HTML.Action("MyPartialViewAction")
当我运行Web应用程序,我得到HttpException与InnerExceptionMessage为:
InnerException {“The partial view ‘~/Views/Shared/MyCustomFolder/_MyPartialView’ was not found or no view engine supports the searched locations. The following locations were searched:\r\n~~/Views/Shared/MyCustomFolder/_MyPartialView”} System.Exception {System.InvalidOperationException}
我到现在为止已经尝试过
尝试将_MyPartialView从〜/ Views / Shared / MyCustomFolder移动到〜/ Views / Shared /和〜/ Views / MyControllerFolder,但仍然存在错误
试着将我的索引查看代码改成@ HTML.RenderAction(),但没有运气。
任何输入,我错了哪里?
谢谢