您的位置:知识库 »

温故知新ASP.NET 2.0(C#)(2) - Themes(主题)

作者: webabcd  发布时间: 2008-09-04 14:35  阅读: 5423 次  推荐: 0   原文链接   [收藏]  

系列文章导航:

温故知新ASP.NET 2.0(C#)(1) - MasterPage(母版页)

温故知新ASP.NET 2.0(C#)(1) - MasterPage(母版页)

温故知新ASP.NET 2.0(C#)(2) - Themes(主题)

温故知新ASP.NET 2.0(C#)(3) - SiteMap(站点地图)

温故知新ASP.NET 2.0(C#)(4) - 缓存&SqlCacheDependency

温故知新ASP.NET 2.0(C#)(5) - Localization

温故知新ASP.NET 2.0(C#)(8) - DataSourceControl

温故知新ASP.NET 2.0(C#)(6) - Membership&RoleManager

温故知新ASP.NET 2.0(C#)(7) - Profile

温故知新ASP.NET 2.0(C#)(8) - DataSourceControl


主题测试-Theme
Themes/Theme.aspx

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Theme.aspx.cs"
    Inherits
="Themes_Theme" Title="主题测试-Theme" Theme="Blue" 
%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
<p>
        在页头部分指定Theme="Blue"
</p>
    
<p>
        相关主题文件,我觉得最好把样式写在css里然后设置控件的CssClass属性
        
<br />
        
&lt;asp:Label ID="Label1" runat="server" BackColor="blue" ForeColor="white" /&gt;
        
<br />
        
&lt;asp:Label ID="Label2" runat="server" BackColor="DarkBlue" ForeColor="white"
        SkinId="Dark" /
&gt;
    
</p>
    
<p>
        
<asp:Label ID="lbl" runat="Server" Text="不做任何设置(使用主题中的没设置SkinId的样式)" />
    
</p>
    
<p>
        
<asp:Label ID="lbl2" runat="Server" Text="设置BackColor为black(因为设置的是页的Theme属性,所以无法覆盖原有样式)" BackColor="black" />
    
</p>
    
<p>
        
<asp:Label ID="lbl3" runat="Server" Text="主题测试设置SkinID为dark(指定SkinId)" SkinID="dark" />
    
</p>
</asp:Content>


主题测试-StylesheetTheme
Themes/StylesheetTheme.aspx

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="StylesheetTheme.aspx.cs"
    Inherits
="Themes_StylesheetTheme" Title="主题测试-StylesheetTheme" StylesheetTheme="Red" 
%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
<p>
        在页头部分指定StylesheetTheme="Red"
</p>
    
<p>
        相关主题文件,我觉得最好把样式写在css里然后设置控件的CssClass属性
        
<br />
        
&lt;asp:Label ID="Label1" runat="server" BackColor="red" ForeColor="white" /&gt;
        
<br />
        
&lt;asp:Label ID="Label2" runat="server" BackColor="DarkRed" ForeColor="white" SkinId="Dark"
        /
&gt;
    
</p>
    
<p>
        
<asp:Label ID="lbl" runat="Server" Text="不做任何设置(使用主题中的没设置SkinId的样式)" />
    
</p>
    
<p>
        
<asp:Label ID="lbl2" runat="Server" Text="设置BackColor为black(因为设置的是页的StylesheetTheme属性,所以可以覆盖原有样式)" BackColor="black" />
    
</p>
    
<p>
        
<asp:Label ID="lbl3" runat="Server" Text="主题测试设置SkinID为dark(指定SkinId)" SkinID="dark" />
    
</p>
</asp:Content>
0
0
标签:ASP.NET Themes

热门文章

    最新文章

      最新新闻

        热门新闻