I'm stuck on the "Creating a Skin for the Button Control" Try it out within Chapter 6. I have the Kindle book so no page numbers, sorry.
I'm using Visual Studio 2010 Professional, I have SQL Server 2008 Developer installed on the backend but haven't gotten to any excercises that use it. I'm coding in Visual Basic.
I have worked through the book and am now stuck on an issue I'm not sure how to fix. I've created the SkinsDemo.aspx file and added the Button control:
<%@ Page Title="Skins Demo" Language="VB" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="false" CodeFile="SkinsDemo.aspx.vb" Inherits="Demos_SkinsDemo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:Button ID="Button1" runat="server" Text="Button" />
I've created the Button.skin file within the Monochrome.css Directory:
CssClass="MyButton" BackColor="#7a70a4" runat="server" />
I've altered the Monochrome.css file to include the .MyButton class:
I do not have a DarkGrey.skin file and I do not have a .MyButton class within the DarkGrey.css file.
My problem is when I "view in browser" the SkinsDemo.aspx file and switch between the DarkGrey and Monochrome themes, the button color doesn't change as it should. The code works and the Button is purple with white text as the skin and Monochrome.css file declare but, it is also purple with white text when the DarkGrey theme is selected. Why are the Monochrome.css and Button.skin settings showing up in the DarkGrey theme???
Or, to put it another way, why is it when I go from the Monochrome theme to the DarkGrey theme, are Monochrome skin and the Monochrome.css settings showing up in the DarkGrey theme settings?
Now, I realize that if I add the .MyBotton class to the DarkGrey.css file and change the color settings to something other then white then the button text will indeed change colors when moving from one theme to another. However, this doesn't seem to be a work around the problem becuase ,then I would have to explicitly add the same classes to both theme.css files that have seperate functionality, everytime i wanted a custom skin for an asp control in a theme.