c# MVC 页面装配

布局模板页面--Layout View
只是概念上为layout View。
@{
     Layout = null;  
   }
 @Html.Action("Header", "Partial") 装配公用的页面---页头。
@RenderBody()   装配内容页
@RenderSection("InlineScripts", required: false) 装配内容页中的脚本,即内容页@section InlineScripts申明部分。
 
最终展示页--
设置布局模板页
@{
ViewBag.Title = "指令";
Layout = "~/Views/Shared/_FrontLayout03.cshtml";
}
 
装配子页面-PartialView
@Html.Action("DailyRecordListDetail", "Front", new { type = ViewBag.Type, el = ViewBag.el })
 
子页面--PartialView
无需设置Layout
 
用razor引擎来粘合后台和前端
razor语法大致是c#的一个子集。

posted @ 2021-08-11 17:43  shijianbo  阅读(130)  评论(0)    收藏  举报