Home / DeveloperSection / Blogs / Themes in

Themes in

Chris Anderson 5604 09-Aug-2011

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in Web Application.

Themes are made up of a set of elements: skins, cascading style sheet (css), images, and other resources.
Themes are defined in special directories in your Website on your Web server. Each theme is a different subfolder of the \App_Themes folder.

MyWebSite à Website name
  App_Themes àFolder that contains Themes
    Theme1 à Theme Folder à SkinFile name
      StyleSheet.css à StyleSheet File Name

How to create Theme?

A skin file has the file name with extension .skin and contains property settings for individual control such as Button, TextBox, Calendar or Label controls. You create skin files in the theme folder.

<asp:Button runat='server' BackColor='Red' ForeColor='White' />

Cascading Style Sheets

A theme can also include a cascading style sheet (.css file). When you put a .css file in the theme folder, the style sheet is applied automatically as a part of the theme. You define a style sheet using a file name extension .css in the theme folder.

                body {
   background-color: #2C2C2C;  }

How to Apply Theme?

You can apply themes to a page or a Web site.

To apply a theme to a Web site

    Add code in web.config file

        <pages theme='Theme1'></pages> //Theme1 is the name of the Theme

To apply a theme to an individual page

     Add code in page directive

  <%@ Page Theme='Theme1' %> //Theme1 is the name of the Theme 

  To apply a theme to an individual page dynamically

  protected void Page_PreInit(object sender, EventArgs e)
              Page.Theme = 'Theme1'; // Theme1 is the name of the theme

Updated 18-Sep-2014
hi I am software developer at mindstick software pvt. ltd.

Leave Comment

Please enter subject.
Please enter comments message.


Liked By