This section describes several controls used during development. For more information, see
-- Master page
In ASP. in NET2.0, the master page is a very special file that contains some fixed static la s on the page. areas that can be used in the derived page are given as special placeholders, during system compilation, the master page and the derived page are integrated and displayed as pages with specific functions at runtime. In the code on the page, except for the distinguished code @ Master, it is the control ContentPlaceHolder, where the content of the derived page is displayed. A standard master page code:
1 <% @ Master Language = "C #" AutoEventWireup = "true" CodeFile = "MasterPage. master. cs" Inherits = "MasterPage" %>
2
3 <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 6 7 <title> No title page </title>
8 <asp: ContentPlaceHolder id = "head" runat = "server">
9 </asp: ContentPlaceHolder>
10 11 <body>
12 <form id = "form1" runat = "server">
13 <div>
14 <asp: ContentPlaceHolder id = "ContentPlaceHolder1" runat = "server">
15
16 </asp: ContentPlaceHolder>
17 </div>
18 </form>
19 </body>
20 21
@ Master at the beginning of the Code indicates that the file is a Master page, which enables the ASP. NET Runtime Library to correctly process the file. The identifier of asp: ContentPlaceHolder is the point character of the derived page. On the master page, you can customize any number of content placeholders.
When a derived page is generated, the content of a normal webpage is no longer displayed in the code, but directed to the master page:
1 <% @ Page Language = "C #" MasterPageFile = "~ /MasterPage. master "AutoEventWireup =" true "CodeFile =" Default2.aspx. cs "Inherits =" Default2 "Title =" "%>
2
3 <asp: Content ID = "Content1" ContentPlaceHolderID = "head" Runat = "Server">
4 </asp: Content>
5 <asp: Content ID = "Content2" ContentPlaceHolderID = "ContentPlaceHolder1" Runat = "Server">
6 </asp: Content>
7
You can perform specific development on the derived page.
-- Site map
A site map is a hierarchical information that can appear in multiple forms. The simplest way is to place a website name under the program directory. the xml file of sitemap, and then use the data source SiteMapDataSource combined with the display control SiteMapPath for combination. In this example, the content of the web. sitemap file is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<SiteMap xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<SiteMapNode url = "~ /Default. aspx "title =" Homepage "description =" Homepage ">
<SiteMapNode title = "data management item">
<SiteMapNode url = "~ /DataList. aspx "title =" Data Maintenance "description =" you can add, modify, and delete data "/>
</SiteMapNode>
<SiteMapNode title = "export data items">
</SiteMapNode>
</SiteMapNode>
</SiteMap>
-- Login
It is a user login control. It provides a user name input box and a password input box. When a user logs on, enter the corresponding information and select the verification button. The default provider will be used for verification. Login also provides some optional interface elements, such as password reminders, new user registration, and help.
-- LoginName
The LoginName control is a very simple control, similar to a label. When a user logs on, the name of the login user is automatically displayed.
-- LoginStatus
This is a very interesting thing. It is usually used in combination with LoginName. Its user interface consists of a logon or exit link button, which is displayed based on the user's logon status. After a user logs on, it is displayed as "quit". If the user does not log on, "Logon" is displayed. After the user selects the user, the logon page is displayed.
-- LoginView
Displays the defined information based on the user's logon status and permissions. This control can create any number of templates, one for each status or role. In this software, only two templates are defined: not logged on and successfully logged on. When not logged on, a template containing the Login control is displayed, waiting for the user to log on, A shortcut template is displayed after logon for user operations.
<Asp: LoginView ID = "LoginView1" runat = "server">
<LoggedInTemplate>
<Asp: TreeView ID = "TreeView1" runat = "server" performanceid = "sitemapperformance1" ShowLines = "True"
Width = "100%">
<LeafNodeStyle NodeSpacing = "0px"/>
</Asp: TreeView>
<Br/>
</LoggedInTemplate>
<AnonymousTemplate>
<Asp: Login ID = "Login1" runat = "server" Width = "100%">
<TextBoxStyle Width = "100px"/>
<LabelStyle Width = "60px"/>
</Asp: Login>
</AnonymousTemplate>
</Asp: LoginView>
This article briefly introduces the controls used in the software. The GridView and DataList controls are more common and more complex. Please use them for separate queries.