Applying Themes and Skins using ASP.NET ,C#

Majith
Posted by in ASP.NET category on for Intermediate level | Views : 14215 red flag

In this article I am going to expalin about Themes and Skin files and how to use it on ASP.NET Files.
Themes and Skins in ASP.NET ,C#
In this article, I will show you how to use  Themes and skins the style of the page in ASP.NET , C#.


Code

1. Add a New website under App_Theme Folder add new skin files from project menus.

2. the code for mytext.skin  file as follow as

<asp:textbox skinid="skin1" runat="server" forecolor="RoyalBlue" backcolor="LightGray"/> 
<asp:textbox skinid="skin2" runat="server" forecolor="DarkGoldenrod" backcolor="GhostWhite"/>
<asp:textbox skinid="skin3" runat="server" BackColor="gainsboro" Font-Bold="true"
BorderColor="green" ForeColor="DarkGreen" Font-Italic="false" />
<asp:TextBox skinid="skin6" runat="server" BackColor="#c4d4e0" ForeColor="#0b12c6" Runat="Server" />
<asp:TextBox skinid="skin7" runat="server" BackColor="#ccccff" ForeColor="#602bff" Runat="Server" />

3. In the Inline code of Default.aspx page add two are three textboxes and some label boxes and one button control.

4. In the Text box control use the property called skin id and use the skin name to the property.

5. For Example:

<asp:textbox id="TextBox6" Text="BlueTheme" skinid="skin6" runat="server"/>

6. Note: Here the the name Skin6 applied to textbox6 control.

The code as follow as


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox6" Text="BlueTheme"
skinid="skin6" runat="server"/>
<br /><br />
<asp:textbox id="TextBox7" Text="PurpleTheme"
skinid="skin7" runat="server"/>
<br /><br />
<asp:textbox id="TextBox1" Text="Gray"
skinid="skin1" runat="server"/>
<br/><br/>
<asp:textbox id="TextBox3" Text="White"
skinid="skin2" runat="server"/>
<br/><br />
<asp:textbox id="TextBox2" text="GreenBorder"
skinid="skin3" runat="server"/>
<br/><br/>
<asp:textbox id="TextBox4" Text="BlackBorder"
skinid="skin4" runat="server"/>
<br /><br />
<asp:textbox id="TextBox5" Text="BlackBorder"
skinid="skin5" runat="server"/>
<br /><br />
<asp:Button ID="b1" runat="server" Text="Next" OnClick="b1_Click" />
</div>

Conclusion
It is an simple example for Skin and themes to controls.
Page copy protected against web site content infringement by Copyscape

About the Author

Majith
Full Name: Majith Basha
Member Level:
Member Status: Member
Member Since: 7/18/2008 11:49:59 PM
Country:



Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)