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:


Session("Theme") = themesDropDownList.SelectedValue
Response.Redirect(Request.Url.ToString())
VB

9. Press F5 to run the application. For Themes select any option and notice how the colors scheme changes. Close the browser.

 
HyperLink HyperLink

Powered By ASP.NET v2.0