Public.Master

1. Open Public.master in Design view.

2. From the Data section //块,部分of the Toolbox, drag a SiteMapDataSource control //控件onto the page, placing it below the table//在<表的下面,可以看看代码视图,可以看到表格所管辖的范围,下图中的图标也标视了这个控件要放的位置>. Set its ID property //属性to "topNavSiteMapDataSource" and its ShowStartingNode property to False.

3. From the Navigation section //块,部分of the Toolbox //工具栏drag a Menu control //菜单控件into the first cell of the second row (which is the first empty row below the row containing the header image). In the Menu Tasks menu, for Choose Data Source, select topNavSiteMapDataSource. Click Convert to DynamicItemTemplate.

4. In the Menu1 Properties window set the ID to "topNavMenu" and Orientation to Horizontal. Expand//展开属性 StaticMenuItemStyle and set the HorizontalPadding property//属性 to "10px". Finally, clear//清除 the value from StaticSubMenuIndent property.

5. From the Toolbox drag a LoginView control into the left cell of the next row. In the AnonymousTemplate type "You are not logged in |". In the LoginView Tasks menu select LoggedInTemplate and type "You are logged in as ". From the Toolbox drag a LoginName control next to the text you just entered. Following this control type " |". Select the LoginName control and press CTRL+B to make the font bold//字体加粗.

6. From the Toolbox drag a LoginStatus control below the LoginView control.

7. In the right cell of the same row type "Theme: ". Drag a DropDownList control to the right of this text. In the DropDownList Tasks menu check Enable PostBack. Click Edit Items and add the following items: "Arctic Ice"//北极冰, "Caribbean Sun"//加勒比太阳, and "Jungle"//密林. Change the ID property of the DropDownList control to "themesDropDownList". Finally, place a space following the DropDownList.

8. Double-click the DropDownList control to create a SelectedIndexChanged event handler.  To this event handler add the following code, which will load one of the three skins in the app_themes folder based on the user's selection:

C# VB  
Session["Theme"] = themesDropDownList.SelectedValue;
            Response.Redirect(Request.Url.ToString());
            

9. Press F5 to run the application. For Themes //主题select any option and notice how the colors scheme//颜色画板 changes. Close the browser.

posted on 2007-04-16 10:31  改变热爱  阅读(176)  评论(0)    收藏  举报

导航