O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Themes and Skins

Many users like to personalize their favorite web sites by setting the look and feel of the site's controls to meet their own personal aesthetic preferences. ASP.NET 2.0 provides support for themes that enable you to offer that level of personalization to your users.

A theme is a collection of skins . A skin describes how a control should look. A skin can define stylesheet attributes, images, colors, and so forth.

Having multiple themes allows your users to choose how they want your site to look by switching from one set of skins to another at the touch of a button. Combined with personalization, your site can remember the look and feel your user prefers.

There are two types of themes. The first, called stylesheet themes , define styles that may be overridden by the page or control. These are, essentially, equivalent to CSS style sheets. The second type, called customization themes , cannot be overridden. You set a stylesheet theme by adding the StyleSheetTheme attribute to the Page directive, and, similarly, you set a Customization theme by setting the Theme attribute in the Page directive.

Tip

You can set the default theme for the entire web site in web.config by adding the pages element to the system.web element within the configuration element, as follows:

    <configuration>
    <system.web>
            <pages theme="Psychedelic" />
        </system.web>
    </configuration>

Settings in the page will override those in web.config.

In any given page, the properties for the controls are set in this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required