网站导航免费论文 原创论文 论文搜索 原创论文 网学软件 学术大家 资料中心 会员中心 问题解答 原创论文 大学论文导航 设计下载 最新论文 下载排行 原创论文 论文源代码
返回网学首页
网学联系
最新论文 推荐专题 热门论文 素材专题
当前位置: 网学 > 编程文档 > ASP.net > 正文

MigratingfromASP.NET1.xtoASP.NET2.0

来源:http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/12
ening with .NET!" > <LINK href="<% =Request.ApplicationPath %>/portal.css" type="text/css" rel="stylesheet"></head>

Themes and Skins

currently, ASP developers must use Cascading Style Sheets (CSS) and inline styles to enforce a look and feel on a Web site. Although these technologies help, consistency is still primarily a function of developer discipline in using the correct styles. ASP.NET 2.0 rectifies this issue through the use of themes and skins, which are applied uniformly across every page and control in a Web site.

Themes

themes are similar to CSS style sheets in that both themes and style sheets define a set of common attributes that apply to any page where the theme or style sheet is applied. However, themes differ from style sheets in the following ways:

  • Themes can define many properties of a control or page, not just a specific set of style properties.
  • Themes can include auxiliary files (for example, graphics) that can''t be included in a CSS style sheet.
  • Themes do not cascade the way style sheets do (for example, theme property values always override local property values).
  • Themes can include style sheet references.

each application has a themes directory. Each specific theme has its own subdirectory that contains skin files and any other files that apply to the style.

Defining a Theme

you can define themes and skins and deploy them in subdirectories stemming from the Themes directory. Each subdirectory constitutes a theme. A theme subdirectory contains .skin files as well as any other resources used by the theme (that is, image files and style sheets).

figure 12. Themes sub directory

the actual skin definitions are contained in the .skin files and look very much like the tags used to declare control instances in ASPX files.

for example, in the Themes directory, create a subdirectory named Pink. To create a .skin file for your theme, simply add the following code and save it in the Pink directory:

<asp:DropDownList runat="server" BackColor="hotpink"   ForeColor="white" /><asp:DataGrid runat="server" BackColor="#CCCCCC" BorderWidth="2pt"    BorderStyle="Solid" BorderColor="#CCCCCC" GridLines="Vertical"    HorizontalAlign="Left">      <HeaderStyle ForeColor="white" BackColor="hotpink" />      <ItemStyle ForeColor="black" BackColor="white" />      <AlternatingItemStyle BackColor="pink" ForeColor="black" /></asp:DataGrid>

this theme can then be applied to pages in your application. Of course, it will turn the background of your data grid hot pink, which may not be a desirable effect.

Using a Theme

themes can be applied:

  • At page level using a single tag: <% @page language="VB" theme="Pink" %>.
  • Site-wide using a configuration element inside of the Web.config file: <pages theme="Pink" />. The Web.config file is the master configuration file for each ASP.NET application.

the effects of a theme can be seen if you examine the common calendar control in Figure 13.

figure 13. Calendar with Basic Blue theme

t

网学推荐

免费论文

原创论文

设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号