Preferred Language:

Listing 6.10 - Web.Config

Illustrates how you can apply a theme to every page in a folder or entire application.

Listing 6.10 - Web.config
Copy

<?xml version="1.0"?>
<configuration>
    <system.web>

        <pages theme="Site" />

    </system.web>
</configuration>

The following configuration file applies a theme using the styleSheetTheme attribute instead of the theme attribute (theme attributes can be overriden on the page).

Listing 6.11 - Web.config
Copy

<?xml version="1.0"?>
<configuration>
    <system.web>

        <pages styleSheetTheme="Site" />

    </system.web>
</configuration>

The following page illustrates how you disable a theme configured in the web.config file for an individual page.

Listing 6.12 - DisablePageTheme.aspx (C#)
Copy

<%@ Page Language="C#" EnableTheming="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Disable Page Theme</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <asp:Label
        id="Label1"
        Text="Don't Theme Me!"
        Runat="server" />
    
    </div>
    </form>
</body>
</html>