Themes and Skins in Visual Studio 2005 ASP.NET 2.0
ASP.NET 2.0 provides rich support for Themes which help in defining consistent look and feel across multiple pages in a web application. One of the file types that you could create within the definition of a theme is a “skin” file. After creating a theme folder in the web application, you can create a skin file by adding a new item and selecting the type as “Skin”. You can add definitions of commonly used server controls in the skin file. When the theme is attached to a web page, all controls declared within the page will inherit the formatting you specified in the skin file.
Look at the sample code snippet below. I have declared these “templates” within a skin file under my theme named “TestTheme” and I have specified this theme in the Page directive of each web page in the application.
---------------------- In the skin file --------------------------------------
<asp:Button runat="server" Font-Bold="true" />
<asp:TextBox runat="server" BackColor="Aquamarine"/>
---------------------- In the ASP.NET page --------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ThemeTester.aspx.vb" Inherits="ThemeTester" EnableTheming="true" Theme="TestTheme" EnableViewState="true" Trace="false" TraceMode="SortByTime"%>
At runtime, the definitions of ASP Button (with font-bold as true) would be applied to all ASP buttons in the page. This makes the ASPX coding lot simpler.