Skins and Themes in ASP.NET

As we see, many of the Websites, Applications are using different graphics, color schema. We can define Skin as set of Combination of Graphics, Color and other properties. This is dependable on CSS, Images and Skin file available on ASP.NET.

Today we will be talking about Skins and themes in ASP.NET here. As we see, many of the Websites, Applications are using different graphics, colour schemas.

We can define Skin as set of Combination of Graphics, Colour and other properties. This is dependable on CSS, Images and Skin file available on ASP.NET.

Be, clear Skins have nothing to do with Backend code and functionality of Web Application. This is only responsible for visual Interface that is presented to user.


a. Visual Studio, Visual Web Developer
b. Basic Knowledge of ASP.NET, CSS and HTML.

Let's make our solution to work for this.

Create a New Web Site by Choosing Empty website.

Add following Items in Empty solution.
a. App_Theme folder
b. Theme1 folder inside App_Theme folder
c. CSS file in Theme1 folder
d. Skin file in Theme1 folder.
e. An Web Form (Page) on Root of Solution

Here is how it look after adding the items mentioned above.

Solution Explorer

I have renamed Theme1 to myTheme and skinfile and css file too.


Skins are of two types:
a. Names Control Skin : "The SkinId should be uniquely defined because duplicate SkinId's per control type are not allowed in the same theme." This is the Definition at Skin File by Developers.
In this case we have to provide ID to separate multiple Skins of same control.

b. Default Control Skin : "The SkinId is not defined. Only one default control skin per control type is allowed in the same theme.". If we do not provide any ID to control, this is only control in Skin file.

Let's Make some changes in our Skin File. I am adding skins for Textbox, H1 element in Skin file. Simply I added a Textbox style, Then Button and a Gridview with Simple Style.

<asp:TextBox runat="server" BackColor="#ccccff" ForeColor="Black" Font-Bold="true" BorderWidth="2px" BorderStyle="Solid"></asp:TextBox>

<asp:Button runat="server" BackColor="#ccccff" ForeColor="Black" Font-Bold="true" BorderWidth="2px" BorderStyle="Solid" />

<asp:GridView runat="server" HeaderStyle-BackColor="#33cccc" AlternatingRowStyle-BackColor="#ffccff"></asp:GridView>

Please note, there is no ID associated in above code.


I have added a H1 and H3 tag, so I have made some changes in our style sheets.

Here is css.

h1 {
color: yellowgreen;

h3 {
font-family:'Segoe UI';


Now the Major thing we need to do is Put a Element in web.config to apply theme.

Inside your Root, go to system.web node and add a element called Pages.

<pages theme="myTheme"></pages>

Now, all the Pages in your Solution has this theme applied. All the controls in your pages will look alike according to skin.


Let's do some coding in Default.aspx

<div align="center">
<h1>Customer Search</h1>
Name :
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<asp:GridView ID="GridView1" runat="server" Width="447px" AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1">
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" />
<asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region" />
<asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers] WHERE ([ContactName] LIKE '%' + @ContactName + '%')">
<asp:ControlParameter ControlID="txt1" Name="ContactName" PropertyName="Text" Type="String" />

This above code will produce below design normally,

Design on Form
Great, Let's code for Button Click also.


I have created DataSource using Northwind database and where clause is using LIKE statement from Textbox to match with ContactName field.

Now While accessed this page from Browser and Clicked Button, below is output.

Output on Browser

In next article, I will be discussing about how to change Themes and Masterpages at Runtime.

All the Best.
John Bhatt
P.Yar.B Complex


  • Skins and Themes (
  • Comments

    No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: