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

零下一度
Release: 2017-05-25 09:21:14
Original
1930 people have browsed it

Web Pages are often related to objects.

Page Object

You have seen some Page object methods in use:

@RenderPage("header.cshtml")
@RenderBody()
Copy after login

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

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

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
Copy after login

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>
Copy after login

[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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!