且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让用户控件了解 ASP.NET 中的 css 类

更新时间:2023-12-06 10:06:34

这是我所做的:

<link rel="Stylesheet" type="text/css" href="Stylesheet.css" id="style" runat="server" visible="false" />

它使 Visual Studio 误以为您已向页面添加了样式表,但它没有被呈现.

It fools Visual Studio into thinking you've added a stylesheet to the page but it doesn't get rendered.

这里有一种更简洁的方法可以使用多个引用来做到这一点;

Here's an even more concise way to do this with multiple references;

<% if (false) { %>
    <link rel="Stylesheet" type="text/css" href="Stylesheet.css" />
    <script type="text/javascript" src="js/jquery-1.2.6.js" />
<% } %>

这篇博文来自 Phil Haack.

As seen in this blog post from Phil Haack.