| id="dropTheme"
AutoPostBack="true"
Runat="Server">
<asp:ListItem Text="YellowTheme" />
<asp:ListItem Text="RedTheme" />
</asp:DropDownList>
</form>
</body>
</html>
列表 16:DynamicTheme.aspx (C#)
<%@ Page Language="C#" %>
<script runat="server">
void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = Request["dropTheme"];
}
</script>
<html>
<head 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>
返回页首
结论
在本文中,我们学习了 ASP.NET 2.0 主题的基础知识和高级应用。主题是一项强大的 ASP.NET Framework 新增功能。通过利用主题功能,可以显著减少您需要添加到各个 ASP.NET 页面的内容量。使用主题功能可以一次定义控件的外观,并可以将该外观应用于整个 Web 应用程序。因此,使用主题功能可以轻松创建具有一致的并可维护的外观设计的网站。
返回页首
参考资料
•
ASP.NET Unleashed
•
ASP.NET v. 2.0-The Beta Version
•
ASP.NET 2.0 Beta Preview
•
Introducing Microsoft ASP.NET 2.0
作者简介
Stephen Walther 编写了有关 ASP.NET 的畅销书 ASP.NET Unleashed。此外,他还是 ASP.NET Community Starter Kit(Microsoft 开发的 ASP.NET 示例应用程序)的体系结构设计师和主要开发人员。他还通过自己的公司 Superexpert (http://www.superexpert.com/) 为美国的公司(包括 NASA 和 Microsoft)提供 ASP.NET 培训。
转到原英文页面
上一页 [1] [2] [3] |