web pages 经常是跟对象有关的。
Page 对象
您已经看到了一些在使用的 Page 对象方法:
@RenderPage("header.cshtml")
@RenderBody()在前面的章节中,您已经看到了两个 Page 对象属性(isPost 和 Request):
If (isPost) {if (Request["Choice"] != null {Page 对象的 Page 属性
Page 对象的 Page 属性,提供了对页面和布局页之间共享的数据的类似属性访问。
您可以对 Page 属性使用(添加)您自己的属性:
Page.Title Page.Version Page.anythingyoulike
页面属性是非常有用的。例如,在内容文件中设置页面标题,并在布局文件中使用:
Home.cshtml
@{
Layout="~/Shared/Layout.cshtml";
Page.Title="Home Page"
}
Welcome to W3CSchool.cc
Web Site Main Ingredients
A Home Page (Default.cshtml)
A Layout File (Layout.cshtml)
A Style Sheet (Site.css)
【相关推荐】
2. 分享ASP.NET学习笔记(1)--WebPages Razor
3. 分享ASP.NET学习笔记(2)--WebPages 介绍
4. 分享ASP.NET学习笔记(3)WebPages 布局










