Developing Websites using Themes (Disabling Themes): Part 5
Introduction
As we know every ASP.NET control includes an EnableTheming property. We can use the EnableTheming property to prevent a Skin from being applied to a particular control in a page. For example, the page given below in image contains two Calendar controls. The second Calendar control has its EnableTheming property set to the value False so it has no Theme.
Calendar.skin Code
<asp:Calendar
BackColor="White"
BorderColor="White"
BorderWidth="1px"
Font-Names="Verdana"
Font-Size="9pt"
ForeColor="Black"
NextPrevFormat="FullMonth"
Width="400px"
Runat="Server">
<SelectedDayStyle
BackColor="#333399"
ForeColor="White" />
<OtherMonthDayStyle
ForeColor="#999999" />
<TodayDayStyle
BackColor="#CCCCCC" />
<NextPrevStyle
Font-Bold="True"
Font-Size="8pt"
ForeColor="#333333"
VerticalAlign="Bottom" />
<DayHeaderStyle
Font-Bold="True"
Font-Size="8pt" />
<TitleStyle
BackColor="White"
BorderColor="Black"
BorderWidth="4px"
Font-Bold="True"
Font-Size="12pt"
ForeColor="#333399" />
</asp:Calendar>
Default.aspx Code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
As we know every ASP.NET control includes an EnableTheming property. We can use the EnableTheming property to prevent a Skin from being applied to a particular control in a page. For example, the page given below in image contains two Calendar controls. The second Calendar control has its EnableTheming property set to the value False so it has no Theme.
Calendar.skin Code
<asp:Calendar
BackColor="White"
BorderColor="White"
BorderWidth="1px"
Font-Names="Verdana"
Font-Size="9pt"
ForeColor="Black"
NextPrevFormat="FullMonth"
Width="400px"
Runat="Server">
<SelectedDayStyle
BackColor="#333399"
ForeColor="White" />
<OtherMonthDayStyle
ForeColor="#999999" />
<TodayDayStyle
BackColor="#CCCCCC" />
<NextPrevStyle
Font-Bold="True"
Font-Size="8pt"
ForeColor="#333333"
VerticalAlign="Bottom" />
<DayHeaderStyle
Font-Bold="True"
Font-Size="8pt" />
<TitleStyle
BackColor="White"
BorderColor="Black"
BorderWidth="4px"
Font-Bold="True"
Font-Size="12pt"
ForeColor="#333399" />
</asp:Calendar>
Default.aspx Code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" Theme="Simple" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar
id="Calendar1"
Runat="server" />
id="Calendar1"
Runat="server" />
<br /><br />
<asp:Calendar
id="Calendar2"
EnableTheming="false"
Runat="server" />
id="Calendar2"
EnableTheming="false"
Runat="server" />
</div>
</form>
</body>
</html>
When we open above page in a web browser, the Skin is applied to the first Calendar control but not the second Calendar control.
Note: Continue in next part.
</form>
</body>
</html>
When we open above page in a web browser, the Skin is applied to the first Calendar control but not the second Calendar control.
Note: Continue in next part.
Comments
Post a Comment