Hope I'm asking this in the correct place, here we go. I've got a solution (ASP.NET Web Project) in VS.NET 2008 that looks like this (only showing important parts)
The site.master has a link to the ie.css style sheet. Everything looks fine in the browser when I run it. But 2008 is giving me "The class or CssClass value is not defined" warnings on classes used in the html of the Header.ascx file. I've seen mention of
this issue with some of the Beta 2008's but I'm not running a beta. Anybody have a solution? I should be able to shape projects this way I would think. Thanks for any help.
I've had this problem in 2005 -- it's a pain. Can you tell me how you're defining where ie.css is placed? If the site.master defines it as "style/ie.css" then it's possible the Header.ascx also looks there, but this relative path becoms "/ctrl/style/ie.css"
and VS complains. I don't really have a fix though, sorry, just if that's the problem then there might be ways to address is....
Please click Mark as Answer if my reply helped you.
http://blog.statichippo.com
"Any fool can recall the flight of birds across a moonlit sky but it takes a genius to forget the face of his mother."
ASCX is a user control which can be used in multiple pages. Each page technically can have separate style or theme applies. Thus, designer does not know which stylesheet to apply to the control until control is included in the page. Here is related thread:
http://forums.asp.net/t/1184716.aspx
I understand, following that logic, why not give me options in VS to "don't validate user control CSS", does any body know if a setting like this exists?
You can add stylesheet references to your user controls, which solves this problem and also means that they render correctly in the designer.
However, your rendered web page will then be littered throughout with stylesheet links (depending on how many you added to each user control, and how many usercontrols you have on your page) - which is far from ideal.
What I don't get is that some of my classes show up and others do not? Why is visual studio so selective on what it displays? I have a masterpage with the css included there. On my usercontrol it's a guessing game as to what css classes will show up.
jbrozek
0 Points
5 Posts
The class or CssClass value is not defined
Dec 30, 2007 02:17 AM|LINK
Hope I'm asking this in the correct place, here we go. I've got a solution (ASP.NET Web Project) in VS.NET 2008 that looks like this (only showing important parts)
main solution
|_ ctrl
|_ Header.ascx
|_ style
|_ ie.css
site.master
default.aspx
The site.master has a link to the ie.css style sheet. Everything looks fine in the browser when I run it. But 2008 is giving me "The class or CssClass value is not defined" warnings on classes used in the html of the Header.ascx file. I've seen mention of this issue with some of the Beta 2008's but I'm not running a beta. Anybody have a solution? I should be able to shape projects this way I would think. Thanks for any help.
VS.NET 2008
noahb
Contributor
2049 Points
360 Posts
Re: The class or CssClass value is not defined
Dec 30, 2007 02:37 AM|LINK
I've had this problem in 2005 -- it's a pain. Can you tell me how you're defining where ie.css is placed? If the site.master defines it as "style/ie.css" then it's possible the Header.ascx also looks there, but this relative path becoms "/ctrl/style/ie.css" and VS complains. I don't really have a fix though, sorry, just if that's the problem then there might be ways to address is....
http://blog.statichippo.com
"Any fool can recall the flight of birds across a moonlit sky but it takes a genius to forget the face of his mother."
Mikhail Arkh...
All-Star
33139 Points
6083 Posts
Microsoft
Re: The class or CssClass value is not defined
Dec 30, 2007 04:55 AM|LINK
ASCX is a user control which can be used in multiple pages. Each page technically can have separate style or theme applies. Thus, designer does not know which stylesheet to apply to the control until control is included in the page. Here is related thread: http://forums.asp.net/t/1184716.aspx
------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
jbrozek
0 Points
5 Posts
Re: The class or CssClass value is not defined
Dec 30, 2007 08:54 PM|LINK
I understand, following that logic, why not give me options in VS to "don't validate user control CSS", does any body know if a setting like this exists?
pbz
Member
310 Points
161 Posts
Re: The class or CssClass value is not defined
Dec 31, 2007 12:16 AM|LINK
I second that...
richardnever...
Member
81 Points
31 Posts
Re: The class or CssClass value is not defined
Jan 24, 2008 04:23 PM|LINK
You can add stylesheet references to your user controls, which solves this problem and also means that they render correctly in the designer.
However, your rendered web page will then be littered throughout with stylesheet links (depending on how many you added to each user control, and how many usercontrols you have on your page) - which is far from ideal.
alun65
Member
4 Points
6 Posts
Re: The class or CssClass value is not defined
Feb 17, 2008 04:45 AM|LINK
If this bugs you, you can turn it off by checking this box (in Tools -> Options) : TextEditor->Validation
You may not want to do this, though… it could potentially save you time if you’re looking for a rendering bug.
Hightechride...
Member
4 Points
3 Posts
Re: The class or CssClass value is not defined
Jul 21, 2008 10:31 PM|LINK
Here's a trick to get rid of the annoying validation message ... add the CSS link in the ASCX but set it to runat="server" and set visible="false".
e.g.
Now you have no validation errors (assuming you have defined the style in the stylesheet) and there are no spurious CSS links all over your page.
nachsart
Member
22 Points
5 Posts
Re: The class or CssClass value is not defined
Aug 21, 2008 08:28 PM|LINK
Hightechrider, Thanks for the tip ... it fixed things up nicely. [Yes]
seed
Member
74 Points
51 Posts
Re: The class or CssClass value is not defined
Mar 24, 2009 08:23 PM|LINK
What I don't get is that some of my classes show up and others do not? Why is visual studio so selective on what it displays? I have a masterpage with the css included there. On my usercontrol it's a guessing game as to what css classes will show up.