VS2008 抱怨它应该知道的 css 类名
我在某个网络广播中看到过这个,但我不记得在哪里,而且我尝试的所有搜索术语都没有帮助。
我的网站有一个样式表,并且在母版页中引用了它。使用此母版页的子页面使用这些样式,但 .Net 不知道它们。当网站运行时,一切都很好,但我试图弄清楚如何让 .Net 在设计时了解它们。
这也应该解决不知道我所包含的 javascript 文件的问题——我认为它们都是相关的,但我一生都无法弄清楚如何做到这一点。
编辑:我是个白痴。这是用于包含样式表的代码。
<link href="<%= ResolveUrl("~/") %>css/styles.css" rel="stylesheet" type="text/css" />
我讨厌那些想得太多的人。哦,还有那些太愚蠢的人,在提出问题之前无法充分调查问题。像我这样的。
I've seen this in a webcast somewhere, but I can't remember where, and all searching terms I'm trying are coming up unhelpful.
I've got a stylesheet for my site, and it's referenced in a master page. Child pages that use this master page use these styles, but .Net doesn't know about them. When the site is run, it all works great, but I'm trying to figure out how to get .Net to know about them at design time.
This should also fix the issue with not knowing about the javascript files I'm including, too -- I think it's all related and I can't for the life of me figure out how.
EDIT: I'm an idiot. This is the code that was being used to include the stylesheet.
<link href="<%= ResolveUrl("~/") %>css/styles.css" rel="stylesheet" type="text/css" />
I hate people who overthink things. Oh, and people who are too stupid to fully investigate an issue before they ask a question. Like me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用“查看”->“管理样式”,它会显示您可以在设计时在页面中使用的 CSS 列表。
更新:实际上您是如何创建子页面的?我刚刚注意到我可以完全访问母版页中引用的样式表类。
我将子页面创建为“网页内容表单”&然后指定母版页。然后,在我的子页面中,当我尝试将 cssclass 添加到标签时,它会为我提供母版页中引用的样式表中的样式列表。
You can try using View->Manage Styles which brings up a list of the css that you can use in your pages at design time.
UPDATE: Actually how are you creating your child page? I just noticed that i have complete access to stylesheet classes that are referenced in master page.
I created child page as 'web content form' & then specified the master page. Then in my child page when i try to add cssclass to a label, it gives me a list of styles from the stylesheet referenced in master page.
我认为这只是 Visual Studio 设计器的限制。它无法知道母版页/子页的所有可能组合,因此有时似乎有点悲观。我不会担心这个。
I think it's just a limitation of Visual Studio's designer. It can't know all of the possible combinations of master pages/child pages, so it just seems to be a bit pessamistic at times. I wouldn't worry about it.