Subscribe Now!

Enter your email address:

Friday, January 21, 2011

Theme and skins in asp.net

Theme is a collection of properties of pages, CSS (cascading style sheets), Skins etc. We can define the properties of the page controls in a skin file and then we can refer the properties for the page web server controls. A theme can be used for the web server controls in order to make the consistent look and feel across your web application.



In earlier version of the Asp.net 1.0 or 1.1 we need to create a Cascading style sheets and then refer we can refer the CSS in a page.

A skin is file with Extension as .skin and it contains the properties for a web server control that is used in web sites.

The advantage of using the Skin file we can define the different properties of a web server control and we can apply to all the controls in a page to give a consistent look to the pages.



Difference between a skin and CSS

Cascading style sheet and the skin are similar. That can be used for applying the properties to all the controls in a page that are defined in a skin or css.

Theme can be not only used for the style attributes it can be use to define a template for a control.

Themes include Graphics, template for controls

Only one theme can be applied to a page. We cannot include any number for CSS file in a page.



Steps to create and include a theme in a page

Create a folder App_themes in your solution and then In Solution Explorer, right-click the name of your theme folder and then click add new item and then select the skin file.

Then we can add the define the properties of the then like below
Here the Class =”asp_label” is defined in a class file

Now we had defined the Properties for the controls

We need to include the theme file in the page like below




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs"
Theme="Mytheme" Inherits="_Default" %>




Now all the labels and textbox in this page will have the common property which will be defined in the Skin and class file

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...