Home  >  Article  >  Backend Development  >  Share ASP.NET study notes (7) Detailed explanation of WebPages objects

Share ASP.NET study notes (7) Detailed explanation of WebPages objects

零下一度
零下一度Original
2017-05-25 09:21:141900browse

Web Pages are often related to objects.

Page Object

You have seen some Page object methods in use:

@RenderPage("header.cshtml")
@RenderBody()

In the previous chapters, you have seen two Page object properties (isPost and Request):

If (isPost) {if (Request["Choice"] != null {

Page property of the Page object

The Page property of the Page object provides similar property access to data shared between pages and layout pages.

You can use (add) your own properties to the Page property:

Page.Title
Page.Version
Page.anythingyoulike

Page properties are very useful. For example, set the page title in the content file and use it in the layout file:

Home.cshtml

@{
Layout="~/Shared/Layout.cshtml";
Page.Title="Home Page"
}
<h1>Welcome to W3CSchool.cc</h1> 
<h2>Web Site Main Ingredients</h2>
<p>A Home Page (Default.cshtml)</p>
<p>A Layout File (Layout.cshtml)</p>
<p>A Style Sheet (Site.css)</p>

[Related recommendations]

1. ASP. NET free video tutorial

2. Share ASP.NET study notes (1)--WebPages Razor

3. Share ASP.NET study Notes (2)--WebPages introduction

4. Share ASP.NET study notes (3) WebPages layout

5. Share ASP. NET study notes (4) Folder

6. Share ASP.NET study notes (5) Global page AppStart and PageStart

7. Share ASP.NET study notes (6) WebPages form

The above is the detailed content of Share ASP.NET study notes (7) Detailed explanation of WebPages objects. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn