Home » CodeDigest


Disabling Theme Set in Web.Config in a Page
Submitted By Satheesh Babu B
On 6/8/2009 8:48:45 AM

Disabling Theme Set in Web.Config in a Page

We use themes and skins to provide consistent look and feel for our application. To apply a theme to whole application we can set it in web.config file [inside System.Web].

<pages theme ="CDTheme1" />


At times, we will have situations to prevent a page from applying the theme we have set in web.config.

This can be achieved by overriding Themes setting in that particular page. Page directive will have a Theme attribute which can be set to "" to prevent the page from applying the theme.


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

If it is a StyleSheetTheme, set StyleSheetTheme =""

Another way of doing this is by overriding these attributes in codebehind.

For Theme,
protected void Page_PreInit(object sender, EventArgs e)
this.Theme = string.Empty;

For StyleSheetTheme,
public override String StyleSheetTheme
get { return string.Empty; }

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..