Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 30th, 2009, 10:39 AM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Plant City FL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Chapter 6; Skins CssClass

I get an error (warning) "The class or CssClass is not defined" when adding class from the Monochrome file for the button. I've doubled checked to ensure the CSS selector is in the Monochrome.css file. The color does not change as it should? Also, after including a named skin for the red buton it also does not chnge as it should?

Here's the cose for the skin file-
<
asp:ButtonCssClass="MyButton"BackColor="#cccccc"runat="server"/>
<
asp:ButtonSkinID="RedButton"BackColor="Red"ForeColor="Black"runat="server"/>

Any help ia appreciated....grat book, so far!

Last edited by jtruffa; April 30th, 2009 at 10:53 AM..
Reply With Quote
  #2 (permalink)  
Old April 30th, 2009, 11:32 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

A few questions:

1. How does your CSS file / selector look?

2. Are you sure the CSS file is current (press Ctrl+F5 to make sure)

Also, the skin file won't show IntelliSense or understand the CssClass as it doesn't now where it's defined.

When you post follow up questions, can you please specify page number and Try It Out step if applicable?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old April 30th, 2009, 02:45 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Plant City FL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6; Skins CssClass

Here's the Css Selector: font-size: 0.7em;
font-weight: bold;
line-height: 37px;
}
.MyButton
{
color:#308462;
}

Not sure how I would tell if the Css file is curent..... Are you sure the CSS file is current (press Ctrl+F5 to make sure)


Sorry about leaving out page and Try it out step...Page 230, TIO Step: Creating a Skin for the Button Control.

thanks agin for the help.
Reply With Quote
  #4 (permalink)  
Old April 30th, 2009, 02:50 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Does your CSS code open just like this? Or is there more code that you haven't posted here? What you posted isn't valid as it starts with rules, not with a selector.

A browser caches a copy of the style sheet, so you may be looking at an old one. By pressing Ctrl+F5 in IE you force the browser to download the latest file.

Can you also post the relevant piece of final HTML in the browser? Do you see the MyButton in that code somewhere?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old April 30th, 2009, 03:20 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Plant City FL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6; Skins CssClass

I added the Css selector at the end of the Monochrome.css file. It looks the same as the file I downloaded from the Wrox web site. If you want I can include the code?

Here's the HTML code. I don't see the reference to "class ="MyButton"".

Again, I apreciate the help.




<!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><title>
Skins Demo
</title>
<link href="../App_Themes/DarkGrey/DarkGrey.css" type="text/css" rel="stylesheet" /></head>
<body>
<form name="aspnetForm" method="post" action="SkinsDemo.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTAxODQ0NzY0Nw9kFgJmD2QWAgIDD2QWAgIFDxBkZBY BAgFkZMheO+YOJHV9CqDhcqc+iw03GEFF" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>

<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBgLa8rSAAwLV7KO2CwKmqP31CQLlh5KuCQL77aOhAwLhg4f +CoAQeOwdT4Efnzwdq998NGrY4afY" />
</div>
<div id="PageWrapper">
<div id="Header"><a href="../" class="HeaderLink">Header Goes Here</a></div>
<div id="MenuWrapper">Menu Goes Here</div>
<div id="MainContent">

<input type="submit" name="ctl00$cpMainContent$Button1" value="Button" id="ctl00_cpMainContent_Button1" />
<input type="submit" name="ctl00$cpMainContent$Button2" value="Button" id="ctl00_cpMainContent_Button2" />
</div>
<div id="Sidebar">Select a Theme<select name="ctl00$lstPreferredTheme" onchange="javascript:setTimeout('__doPostBack(\'ct l00$lstPreferredTheme\',\'\')', 0)" id="ctl00_lstPreferredTheme">
<option value="Monochrome">Monochrome</option>
<option selected="selected" value="DarkGrey">DarkGrey</option>
</select>
</div>
<div id="Footer">Footer Goes Here</div>
</div>
</form>

</body>
</html>
Reply With Quote
  #6 (permalink)  
Old April 30th, 2009, 03:45 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

That's pretty odd. Most of it looks good (page, link to the CSS file, the theme and so on) but it seems the skin is not applied.

Where did you place the Skin file exactly? What's the name of the file and how does its content look?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old April 30th, 2009, 05:58 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Plant City FL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6; Skins CssClass

The Skin file is in the Monochrome theme folder.

Here's the code for the skins file and the error message-

<asp:ButtonCssClass="MyButton"BackColor="#cccccc"runat="server"/>
<
asp:ButtonSkinID="RedButton"BackColor="Red"ForeColor="Black"runat="server"/>

Warning 2 The class or CssClass value is not defined. C:\BegASPNET\Site\App_Themes\Monochrome\Button.ski n 1 23 C:\BegASPNET\Site\

Reply With Quote
  #8 (permalink)  
Old May 1st, 2009, 03:50 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

The warning is not a problem; the Skin file simply can't find the theme's CSS file. This is OK and not a problem.

However, it's strange that the skin is not applied to the control. Can you zip your project and send it to me?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #9 (permalink)  
Old May 1st, 2009, 05:44 PM
Authorized User
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Plant City FL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6; CssClass

Would love to send zip file...what's the best way to get it to you?
Reply With Quote
  #10 (permalink)  
Old May 1st, 2009, 05:48 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Send me a message through the Contact page of my personal web site. I'll reply so you know my address....

IMar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ch6 Skins and Named Skins wingri BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 8th, 2008 02:57 AM
Does the CssClass property works with AJAX ? tedhill BOOK: Beginning Ajax with ASP.NET 2 December 16th, 2006 08:53 AM
Creating Form skins/Theme chiefouko Pro VB.NET 2002/2003 0 September 14th, 2004 12:15 AM
Push Button Column in DataGrid (CssClass) doonbug General .NET 0 July 20th, 2004 10:34 AM



All times are GMT -4. The time now is 08:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.