| home / programming / asp / site_appearance2 |
[next] |
|
|
To finish our coverage of themes, let's examine an example that demonstrates the dynamic selection of themes. The example page contains a drop-down list that allows the user to select one of two different themes to be applied to that page. The markup for this page is shown in Listing 6.3. Notice that the page contains no appearance markup, only structured content. All formatting is contained in the theme skins and CSS files.
Listing 6.3ThemeTester.aspx
The markup contains a drop-down list that allows the user to select the theme. The code-behind for the page performs this processing, as shown in Listing 6.4.
Listing 6.4 ThemeTester.aspx.cs
By keeping your markup devoid of appearance formatting, it can be quite radically transformed by your themes. This example has two different themes: one called Cool and the other called Professional.
Figure 6.7 illustrates how this page appears in its two themes (the Cool theme is the one on the right with two layout columns).
The skins for these two themes (shown in Listings 6.5 and 6.6) are quite similar as well as quite straightforward. Notice that both skins delegate the actual formatting to each theme's CSS file.
Listing 6.5 Cool.skin
Listing 6.6 Professional.skin
| home / programming / asp / site_appearance2 |
[next] |
URL: