下图显示了 Partial View GetMovieTypes.cshtml
位于 Shared
文件夹中
我在 EmployeeController 的索引 View 中使用 @Html.Partial("GetMovieTypes.cshtml")
行调用部分 View
Issue is I get Server Error when I call the Employee Controller with Index Action
The partial view '_GetMovieTypes.cshtml' was not found or no view engine supports the searched locations. The following locations were searched:
~/Areas/Staff/Views/Employee/GetMovieTypes.cshtml.cshtml
但是当我将 PartialView 重命名为 GetMovieTypes.cshtml.cshtml
时,它工作正常
为什么 ViewEngine 强制我添加 .cshtml 扩展两次
最佳答案
删除 .cshtml
部分:
@Html.Partial("GetMovieTypes")
关于c# - ASP.NET MVC 3 View 引擎无法识别带有 .cshtml 的 PartialView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12039080/