Creating A Master Page
In this section you will add a Master Page to your project, format it, and then add one of the new ASP.NET 2.0 navigational control's to it.
1. Add a Master Page to your project just as you would any other new item. In the Solution Explorer, right-click the project and select Add New Item. In the Add New Item dialog select Master Page, and then click Add.
| C# | VB | |
|
|
||
On the design surface of the Master Page you are going to add an HTML table for positioning//定位 some of the controls on the page. When switching to the design surface, you will notice that a ContentPlaceHolder control//内容放置容器控件 has already been placed on the Master Page. The content of pages that use this Master Page is placed in this ContentPlaceHolder control. You will see how this all comes together when you reference //参考the Master Page from an ASPX page.
2. Below the Code Editor window click Design. Select the Layout | Insert Table menu command. In the Insert Table dialog select Template. From the Templates menu select Header and side, and then click OK.

3. Place your cursor //光标in the lower right cell of the table, and then press F4. In the Properties window, for VAlign select top. Drag//拖 the existing ContentPlaceHolder control into this cell. Add an "Authors" header (H1) to the top cell, and then click and drag //拖the bottom border of this cell to shorten its height//减少它的高度. The final layout should look like this:

4. Click into the lower left cell and press F4. In the Properties window, for VAlign select top.
5. From the Toolbox drag a Menu control onto the design surface, placing it in the lower left cell.

6. In the Menu Tasks Window For Choose Data Source select <New data source...>. In the Data Source Configuration Wizard select Site Map. Change the default ID to a more meaningful ID "menuSiteMapDataSource", and then click OK.
This site map data source//站点地图数据源 is an XML file called Web.sitemap that must reside in the root of your Web site. It contains the navigation menu hierarchy//阶梯导航菜单. You will be editing it in the next lesson.
7. Finally, give the ContentPlaceHolder control a more meaningful ID. In its Properties window change (ID) to "bodyContentPlaceHolder".


浙公网安备 33010602011771号