一般方法为创建pagebase类 使其继承自ystem.Web.UI.Page
其他需要动态这是主题的页面 继承自pagebase类
须注意的是对于设置Theme应重写Page_Init方法
而更为常用的StyleSheetTheme则应重写其属性来实现
1 protected void Page_Init(EventArgs e)
2 {
3 string theme = MyFunction.MyCache.GetCache("theme") as string;
4 if (!string.IsNullOrEmpty(theme))
5 {
6 Page.Theme = theme;
7 }
8 }
9
10 public override String StyleSheetTheme
11 {
12 get
13 {
14 string theme = MyFunction.MyCache.GetCache("theme") as string;
15 if (!string.IsNullOrEmpty(theme))
16 return theme;
17 else
18 return "";
19 }
20 }
2 {
3 string theme = MyFunction.MyCache.GetCache("theme") as string;
4 if (!string.IsNullOrEmpty(theme))
5 {
6 Page.Theme = theme;
7 }
8 }
9
10 public override String StyleSheetTheme
11 {
12 get
13 {
14 string theme = MyFunction.MyCache.GetCache("theme") as string;
15 if (!string.IsNullOrEmpty(theme))
16 return theme;
17 else
18 return "";
19 }
20 }