首页 > 代码库 > 002-MVC布局页

002-MVC布局页

~/Views/Shared/_LayoutPage1.cshtml

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta name="viewport" content="width=device-width" />
 5     <title>@ViewBag.Title</title>
 6     @RenderSection("head", true)
 7 </head>
 8 <body>
 9     <div>
10         布局页面
11         @RenderBody()
12     </div>
13 </body>
14 </html>

~/Views/AjaxDemo/Show.cshtml

 1 @{
 2     ViewBag.Title = "Show";
 3     Layout = "~/Views/Shared/_LayoutPage1.cshtml";
 4 }
 5 @section head{
 6     <script type="text/javascript">
 7 
 8     </script>
 9 }
10 @using MvcApplication1.Models
11 @model MvcApplication1.Models.UserInfo
12 <h2>Show</h2>
13 <table>
14     <tr><td>Hello,World</td></tr>
15 </table>

 

002-MVC布局页