惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
C
Check Point Blog
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG

博客园 - enjoy .net

visual basic video series:Forms over data 无功倒送问题 变压器高低压侧的电流计算 爬电、爬距(泄漏距离)、爬电比距 使用BackgroundWorker进行Thread编程 VS2005的初体验 地板选购指南 IT服务管理时代已经到来 IT服务管理的效果分析 How to use the Install from Media feature to promote Windows Server 2003-based domain controllers 70-294读书笔记 TechED上海 术语: Tombstone/Tombstone Lifetime Windows 2003故障恢复 几乎没有管理的国企! ASP.Net 2.0中的Membership,Role和Profile ntdsutil的功能 体验了一次DNS的动态更新功能 Flexible Single Master Operations (FSMO)
关于ASP.Net 2.0中的Theme
enjoy .net · 2005-08-14 · via 博客园 - enjoy .net

1、Theme和CSS的定义
Themes are not the same thing as cascading style sheets.
Cascading style sheets enable you to control the appearance of HTML tags on the browser.
Themes, on the other hand, are applied on the server and they apply to the properties of ASP.NET controls. For example, you can use a theme, but not a cascading style sheet, to specify whether or not a GridView control displays a header or footer.
也就是说Theme针对ASP.Net Server Controls而CSS针对HTML中的Tags

2、Theme(主题)是在后缀名为.skin的皮肤文件中定义的

3、Default Skin和Named Skin
如果ASPX中的Server Control没有指明Control ID,则将应用Default Skin,否则将使用名称一致的Named Skin。注意如果要应用Theme,首先必须ASPX文件的头部即在Page指令中定义Theme,如下所示:
<%@ Page Theme="OrangeTheme" %>

4、将Theme应用到整个应用
在Web.Config文件中加入黑体所示的代码
<configuration>
    <system.web>
  <pages theme="OrangeTheme" />
    </system.web>
</configuration>

5、Theme和StyleSheetTheme
当应用Theme时,Theme中的属性的优先级要高于Server Control中指定属性的优先级。
而通过应用StyleSheetTheme,则可以使Server Control中的属性覆盖StyleSheetTheme中的属性。

6、Theme和CSS
可以将CSS文件放入Theme所在的文件夹,当页面应用Theme时,将自动应用CSS。

7、Theme要比CSS灵活一点,这主要体现在可以通过代码对Theme进行设置和访问。这样就可以很方便地定制用户喜爱的显示方式。

<%@ Page Language="VB" %>
<script runat="server">
    Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs)
        Page.Theme = Request("dropTheme")
    End Sub
</script>
<html>
<head id="Head1" runat="server">
    <title>Dynamic Theme</title>
</head>
<body>
    <form id="form1" runat="server">
    
    <asp:DropDownList
        id="dropTheme"
        AutoPostBack="true"
        Runat="Server">
        <asp:ListItem Text="YellowTheme" />
        <asp:ListItem Text="RedTheme" />
    </asp:DropDownList>

    </form>
</body>
</html>

参考网址Creating Web Application Themes in ASP.NET 2.0