Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 25, 2010 10:09 AM by coalvilledave
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)
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.
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....
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:
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?
Dec 31, 2007 12:16 AM|LINK
I second that...
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.
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.
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".
<link href="/css/main2.css" rel="stylesheet" type="text/css" runat="server" id="styleMain" visible="false" />
Aug 21, 2008 08:28 PM|LINK
Hightechrider, Thanks for the tip ... it fixed things up nicely. [Yes]
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.