zoukankan      html  css  js  c++  java
  • 代码重复的有效手段——skin

    参考资料:
    http://tech.sina.com.cn/s/2006-07-13/09071034998.shtml
    http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/2008224/101379_2.html

    使用 ASP.NET 2.0 的“主题和外观”功能,可以将样式和布局信息分解为单独的文件组,统称为“主题”。然后,主题可应用于任何站点,影响站点中页和控件的外观。这样,通过更改主题即可轻松地维护对站点的样式更改,而无需对站点各页进行编辑。还可与其他开发人员共享主题。应用 ASP.NET 2.0的“主题和外观”功能轻松实现对网站美观的控制。
    注意事项:
    当单击“添加”按扭以后会弹出如下对话框 图 2 问你是否将主题文件添加到“App_Themes”文件夹,在应用程序中,主题文件必须存储在根目录的App_Themes文件夹下,主题由此文件夹下的命名子目录组成,该子目录包含一个或多个具有 .skin 扩展名的外观文件的集合。主题还可以包含一个 CSS 文件和/或图像等静态文件的子目录。我们单击“是”,这样就为Web添加一个名为“Button”的主题。

    关于Skin的定义
    在vs2008中没有代码的智能提示
    确认下vs2010中是否有代码的智能提示呢?

    创建skin文件:

    <%--
    Default skin template. The following skins are provided as examples only.

    1. Named control skin. The SkinId should be uniquely defined because
       duplicate SkinId's per control type are not allowed in the same theme.

    <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
       <AlternatingRowStyle BackColor="Blue" />
    </asp:GridView>

    2. Default skin. The SkinId is not defined. Only one default
       control skin per control type is allowed in the same theme.

    <asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
    --%>
    <asp:Button runat = "server" BorderColor="yellow" BackColor="yellow" BorderStyle="dotted" />
    <asp:Button runat = "server" BorderColor="blue" BackColor="white" SkinID="Blue" />
    <asp:Button runat = "server" BorderColor="red" BackColor="red" Width="150" BorderWidth="2px" SkinID="red"/>

    使用skin

    <%@ Page Language="C#" AutoEventWireup="true" Theme="Button"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <asp:Button ID="Button1" runat="server" Text="Button" />
    &nbsp;&nbsp; 默认皮肤的button控件<br />
            <br />
            <asp:Button ID="Button2" runat="server" Text="Button" SkinID="Blue" />
    &nbsp; 命名皮肤SkinID=&quot;Blue&quot;的Button控件<br />
            <br />
            <asp:Button ID="Button3" runat="server" Text="Button" SkinID="red" />
    &nbsp;命名皮肤SkinID=&quot;red&quot;的Button控件<br />
            <br />
            <asp:Button ID="Button4" runat="server" Text="Button" EnableTheming="False" />
    &nbsp;禁用主题的Button控件<br />
       
        </div>
        </form>
    </body>
    </html>


    页面跳转的常用做法
    使用Response.Redirect

    相关下载:
    http://www.cnblogs.com/cleo/archive/2007/01/16/freetextbox3_1_6.html

  • 相关阅读:
    个人:我的2011生活看板
    个人管理:公司做的稻盛阿米巴培训笔记
    使用TOGAF来做业务架构 价值驱动产品开发
    30天敏捷结果(21)正面失败,吸取教训,改善结果
    2010年12月blog汇总:敏捷个人
    30天敏捷结果(25):固定时间,灵活范围
    101与金根回顾敏捷个人:(11)执行力
    团队管理:设计团队的一周
    云:构建云计算的核心技术与平台
    读书笔记:千万别学英语
  • 原文地址:https://www.cnblogs.com/mingle/p/1708464.html
Copyright © 2011-2022 走看看