O'Reilly logo

Programming ASP.NET 3.5, 4th Edition by Jesse Liberty, Dan Hurwitz, Dan Maharry

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 websites by setting the look and feel of the site’s controls to meet their own personal aesthetic preferences. ASP.NET 3.5 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:

  • Stylesheet themes define styles that may be overridden by the page or control. These are, essentially, equivalent to CSS stylesheets.

  • Customization themes define styles that 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 website 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 order:

  1. Properties are applied first ...

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