Named Skins
You can only specify
one default control-skin in a theme per control type. In our example, it would
not make sense to define a second skin for the Label control in the Odeish
theme since we already have a skin defined for Label, and ASP.NET would not
know which to use. However, you can specify alternative named skins for
a control with the SkinID property.
In the skin file that
follows, we’ve defined the default skin for a label to use a BlueViolet color,
while the skin named BlackLabel will use a black forecolor.
<asp:Label
runat="server" ForeColor="BlueViolet" />
<asp:Label
runat="server" ForeColor="Black" SkinID="BlackLabel" />
Inside of the
following web form excerpt, the first label control will use the default
control skin (assuming the page’s Theme property is set properly), while the
second label control uses the BlackLabel named skin.
<body>
<form id="form1" runat="server">
<div>
<asp:Label runat="server" ID="label1"
Text="Hello World" />
<br />
<asp:Label runat="server" ID="label2"
Text="Hello World" SkinID="BlackLabel" />
</div>
</form>
</body>
No comments:
Post a Comment