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.


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:

      <pages theme="Psychedelic" />

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 ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.