今天项目上遇到一个错误:
1、在模板页_layout中设置了this.RenderSection("seectionName", true);
是要求在其子页中必须有@section location{ /* 内容 */ }
2、如果controller中使用return this.view();
是默认返回和action同名的view并且继承模板页。但由于模板页中包含了RenderSection
所以会报找不到SectionName的错误
3、创建视图的时候如果是分部视图应该选择:
4、如果返回的是分部视图,那么应该用PartialView
PartialView("viewName");