CODEDIGEST
Home Articles CodeDigest Tutorials FAQs
Home > CodeDigest >  
Technologies
 


Applying themes through ASPX, Web.Config and Dynamically in ASP.Net
Submitted By Satheesh Babu B
On 11/14/2008 5:50:17 AM
Tags: asp.net,CodeDigest  

 

Applying themes through ASPX, Web.Config and Dynamically in ASP.Net 2.0

 

This code snippet will help us to apply themes through ASPX page, web.config and dynamically in C# and ASP.Net 2.0. 

 

Themes are the text-based style definitions in ASP.NET 2.0. Themes are similar to Cascading Style Sheets (CSS) in that they enable you to define visual styles for your Web pages. 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 a Web application, across an entire Web application, or across all Web applications on a server.

 

A theme can be applied to a form through the @Page Directive by the following syntax,

<%@Page Language="VB" Theme="DotNetIndiaSkin" %>

We can also apply it at an application level from the web.config file.

<system.web>
<pages theme=" DotNetIndiaSkin" />
</system.web>

 

Programmatically Setting the Themes

 

We can set the Theme attribute of Page Programmatically in Page_PreInit Event to apply themes dynamically.

 

protected void Page_PreInit(object sender, EventArgs e)

{

Page.Theme="DotNetIndiaClassic";

}

Recent Codes
  • View All Codes..