首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何使用户控件了解ASP.NET中的css类

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

Stack Overflow用户
提问于 2008-08-29 11:37:55
回答 2查看 58.9K关注 0票数 51

由于asp.net中没有用户控件的标题部分,因此用户控件无法了解样式表文件。因此,visual studio无法识别用户控件中的css类并生成警告。如何让用户控件知道它将与css类相关,所以如果它警告我一个不存在的css类,那就意味着这个类确实不存在?

编辑:或者我应该采用一种不同的设计,比如将css类暴露为属性,就像GridView的"HeaderStyle-CssClass“一样?

EN

回答 2

Stack Overflow用户

发布于 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 
票数 3
EN

Stack Overflow用户

发布于 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>

这将会起作用。

票数 -4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34390

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档