- @{
- IList<Mvc3Application1.StudentEntity> studentEntities = Mvc3Application1.ReaderSQL_Date.GetAllStudent();
- }
- <!DOCTYPE html>
- <html>
- <head>
- <title>@ViewBag.Title</title>
- </head>
- <body>
- <div>
- @{
- <table>
- <tr>
- <th>学号</th>
- <th>姓名</th>
- <th>年龄</th>
- </tr>
- @foreach (Mvc3Application1.StudentEntity item in studentEntities)
- {
- <tr>
- <td>@item.S_No</td>
- <td>@item.S_Name</td>
- <td>@item.S_Age</td>
- </tr>
- }
- </table>
- }
- 开始渲染Body<br />
- @RenderBody()
- 渲染Body结束<br />
- <br />
- 开始渲染其他页<br />
- @RenderPage("~/Views/Home/ViewPage1.cshtml")
- 渲染其他页结束<br />
- <br />
- HOHO,开始学习Section了<br />
- 开始渲染Section<br />
- 声明方式1(推荐):SectionA:<br />
- @RenderSection("SectionA", false)
- -------<br />
- 声明方式2:SectionB:<br />
- @{
- if (IsSectionDefined("SectionB"))
- {
- @RenderSection("SectionB")
- }
- }
- -------<br />
- 渲染Sction结束<br />
- </div>
- </body>
- </html>
最