Themes, Skins, and ASP.NET 2.0
by Vikram Srivatsa 

Listing One

Button.skin
<asp:Button 
   BorderColor  = "LightSlateGray"
   BorderStyle  = "Inset"
   BorderWidth  = "4px"
   Font-Bold     = "True"
   Font-Name   = "Verdana"
   Font-Size     = "XX-Small"
   ForeColor    = "Black"
   Runat         = "Server" 
/> 

Listing Two

Dropdown.skin
<asp:DropDownList   
   Font-Bold    = "True"
   Font-Name  = "Verdana"
   Font-Size    = "XX-Small"
   ForeColor    = "Gray"
   Runat        = "Server" 
/>

Label.skin
<asp:Label
   BackColor  = "WhiteSmoke" 
   ForeColor  = "DarkSlateGray"
   Font-Bold  = "True"
   Font-Name = "Verdana"
   Font-Size  = "XX-Small"
   Runat       = "Server" 
/>

TextBox.skin
<asp:TextBox 
   BackColor   = "WhiteSmoke" 
   ForeColor   = "DarkGray" 
   Font-Bold   = "True"
   Font-Name  = "Verdana"
   Font-Size   = "XX-Small"
   Runat        = "Server" 
/>

Listing Three 

(a)

Setting Theme In Code at Runtime
void Page_PreInit(object sender, EventArgs e)
{
   Page.Theme = "SimpleGrayTheme";      
}


(b)
Web.config
<configuration>
    <system.web>
    <pages theme="SimpleGrayTheme" />
    </system.web>
</configuration>

Listing Four

TextBox.skin
<asp:TextBox 
   BackColor  = "WhiteSmoke" 
   ForeColor  = "DarkGray" 
   Font-Bold  = "True"
   Font-Name  = "Verdana"
   Font-Size  = "XX-Small"
   Runat      = "Server" 
/>

<asp:TextBox 
   SkinId     = "RequiredTextBox"  
   BackColor  = "Yellow" 
   ForeColor  = "DarkGray" 
   Font-Bold  = "True"
   Font-Name  = "Verdana"
   Font-Size  = "XX-Small"
   Runat      = "Server" 
/>

<asp:TextBox 
   SkinId     = "MultiLineTextBox"  
   BackColor  = "White" 
   ForeColor  = "Black" 
   Font-Bold  = "True"
   Font-Name  = "Verdana"
   Font-Size  = "XX-Small"
   Runat      = "Server" 
/>


2


