动态应用主题
<%-- 主题2 App_Themes\SecondTheme\ 默认的外观模板。以下外观仅作为示例提供。 1. 命名的控件外观。SkinId 的定义应唯一,因为在同一主题中不允许一个控件类型有重复的 SkinId。 2. 默认外观。未定义 SkinId。在同一主题中每个控件类型只允许有一个默认的控件外观。 --%>
1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Theme="" %>
2:
3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4:
5: <script runat =server>
6: void Page_PreInit(object sender, EventArgs e)
7: {
8: string name;
9: if (Request.QueryString["theme"] == null)
10: {
11: Theme = "FirstTheme";
12: Response.Write(Request.Path +"?"+Request.QueryString["theme"]);
13: }
14: else
15: {
16: Theme = Request.QueryString["theme"];
17: Response.Write(Request.Path +"?"+Request.QueryString["theme"]);
18: }
19: Page.Theme =Theme;
20:
21: }
22:
23: </script>
24:
25:
26:
27: <html xmlns="http://www.w3.org/1999/xhtml">
28: <head runat="server">
29: <title>无标题页</title>
30: </head>
31: <body>
32: <form id="form1" runat="server">
33: <div>
34:
35: <br />
36: <asp:Image ID="Image1" runat="server" />
37: <br />
38: <br />
39: <br />
40:
41: <asp:Button ID="Button1" runat="server" Text="Water" SkinID="skin2"
42: onclick="Button1_Click" />
43:
44:
45: <asp:Button ID="Button2" runat="server" SkinID="skin1" Text="Sun"
46: onclick="Button2_Click1" style="height: 29px" />
47:
48:
49: <br />
50: <asp:Button ID="Button3" runat="server" Text="Test" />
51:
52: </div>
53: </form>
54: </body>
55: </html>
1: <%--
2:
3: 主题2
4: App_Themes\SecondTheme\
5: 默认的外观模板。以下外观仅作为示例提供。
6:
7: 1. 命名的控件外观。SkinId 的定义应唯一,因为在同一主题中不允许一个控件类型有重复的 SkinId。
8:
9: <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
10: <AlternatingRowStyle BackColor="Blue" />
11: </asp:GridView>
12:
13: 2. 默认外观。未定义 SkinId。在同一主题中每个控件类型只允许有一个默认的控件外观。
14:
15: <asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
16:
17:
18: <asp:Button runat="server" SkinID="skin1" Width="96px" BackColor="White" BorderStyle="Groove" Font-Bold="True" ForeColor ="Brown"/>
19: <asp:Button runat="server" SkinID="skin2" BackColor="#404040" Font-Bold="True" ForeColor="White" Width="92px"/>
20: <asp:Button runat="server" SkinID="skin3" BackColor="#00CC66" BorderColor="#0099FF" BorderStyle="Dashed" BorderWidth="10px " Font-Bold="True" Font-Names="AR BERKLEY" Font-Overline="False" Font-Size="Medium" Font-Strikeout="False" />
21: --%>
22:
23: <asp:Image runat="server" ImageUrl="~\App_Themes\SecondTheme\W020101222388512425096.jpg" />
24:
1: <%--
2: 主题1
3: \App_Themes\FirstTheme\
4:
5: 默认的外观模板。以下外观仅作为示例提供。
6:
7: 1. 命名的控件外观。SkinId 的定义应唯一,因为在同一主题中不允许一个控件类型有重复的 SkinId。
8:
9: <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
10: <AlternatingRowStyle BackColor="Blue" />
11: </asp:GridView>
12:
13: 2. 默认外观。未定义 SkinId。在同一主题中每个控件类型只允许有一个默认的控件外观。
14:
15: <asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
16:
17:
18: <asp:Button runat="server" SkinID="skin1" Width="96px" BackColor="White" BorderStyle="Groove" Font-Bold="True" ForeColor ="Brown"/>
19:
20:
21: <asp:Button runat="server" SkinED="skin2" BackColor="#404040" Font-Bold="True" ForeColor="White" Width="92px"/>
22: --%>
23:
24: <asp:Image runat="server" ImageUrl="~\App_Themes\FirstTheme\W020101222388523142073.jpg"/>
1: using System;
2: using System.Configuration;
3: using System.Data;
4: using System.Linq;
5: using System.Web;
6: using System.Web.Security;
7: using System.Web.UI;
8: using System.Web.UI.HtmlControls;
9: using System.Web.UI.WebControls;
10: using System.Web.UI.WebControls.WebParts;
11: using System.Xml.Linq;
12:
13: public partial class _Default : System.Web.UI.Page
14: {
15: protected void Page_Load(object sender, EventArgs e)
16: {
17:
18: }
19: protected void Button1_Click(object sender, EventArgs e)
20: {
21: string url = Request.Path + "?theme=" + "FirstTheme";
22: Response.Redirect(url);
23: }
24:
25:
26: protected void Button2_Click1(object sender, EventArgs e)
27: {
28: string url = Request.Path + "?theme=" + "SecondTheme";
29: Response.Redirect(url);
30: }
31: }