由于asp.net中没有用户控件的标题部分,因此用户控件无法了解样式表文件。因此,visual studio无法识别用户控件中的css类并生成警告。如何让用户控件知道它将与css类相关,所以如果它警告我一个不存在的css类,那就意味着这个类确实不存在?
编辑:或者我应该采用一种不同的设计,比如将css类暴露为属性,就像GridView的"HeaderStyle-CssClass“一样?
发布于 2013-02-08 22:42:53
在你的用户控件上添加样式并在其中导入css。
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WCReportCalendar.ascx.vb"
Inherits="Intra.WCReportCalender" %>
<style type='text/css'>
@import url("path of file.css");
// This is how i used jqueryui css
@import url("http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css");
</style>
your html
发布于 2012-03-31 13:58:11
您可以在userControl
中直接使用CSS
。
在UserControl
中使用它
<head>
<title></title>
<style type="text/css">
.wrapper {
margin: 0 auto -142px;
/* the bottom margin is the negative value of the footer's height */
}
</style>
</head>
这将会起作用。
https://stackoverflow.com/questions/34390
复制相似问题