博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
动态加载主题
阅读量:4512 次
发布时间:2019-06-08

本文共 2038 字,大约阅读时间需要 6 分钟。

先来目录:

 

css文件代码:(当然自己随意写吧,没多难)

1 body  2 { 3     text-align:center; 4     color:Yellow; 5     background-color:Navy; 6 } 7 A:link 8 { 9    color:White;10    text-decoration:underline;    11 }12 A:visited13 {14     color:White;15     text-decoration:underline;    16 }17 A:hover18 {19     color:Fuchsia;20     text-decoration:underline;21     font-style:italic;    22 }23 input 24 {25     border-color:Yellow;    26 }
View Code

skin文件代码:(这个看看格式,注意下格式就行)

1 <%-- 2 默认的外观模板。以下外观仅作为示例提供。 3  4 1. 命名的控件外观。SkinId 的定义应唯一,因为在同一主题中不允许一个控件类型有重复的 SkinId。 5  6 
7
8
9 10 2. 默认外观。未定义 SkinId。在同一主题中每个控件类型只允许有一个默认的控件外观。11 12
13 --%>14
16
View Code

重点来了:

空网站添加DropDownList控件。设置属性如下:

  

点击后设置为

里面的Theme1和Theme2就对应目录里的。

当然上面也可以设置属性为,Theme = "Theme1",但这样就只能显示一个主题了╮(╯▽╰)╭。 

cs文件代码:

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 using System.Web.Query; 8  9 10 public partial class _Default : System.Web.UI.Page11 {12     protected void Page_Load(object sender, EventArgs e)13     {14 15     }16     //Dropdownlist里的这个事件的作用是,每当选项发生改变时会触发一个事件17     protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)18     {19         string url = Request.Path + "?theme=" + DropDownList1.SelectedItem.Value;20         Response.Redirect(url);21     }22     void Page_PreInit(object sender, EventArgs e) {23         string theme = "theme1";24         if (Request.QueryString["theme"] == null)25         {26             theme = "theme1";27         }28         else {29             theme = Request.QueryString["theme"];30         }31         Page.Theme = theme;32         ListItem item = DropDownList1.Items.FindByValue(theme);33         if (item != null) {34             item.Selected = true;35         }36     }37     protected void button1_Click(object sender, EventArgs e)38     {39 40     }41 }
View Code

好了,这就完成了。来,看结果。

还行。。。umumumy。

转载于:https://www.cnblogs.com/chenluomenggongzi/p/5528263.html

你可能感兴趣的文章
underscore
查看>>
springboot项目如何在tomcat6中部署成功
查看>>
神器metasploit中Msfvenom 的用法(外文翻译转)
查看>>
[项目管理] 布鲁克斯法则
查看>>
SpringMVC
查看>>
交通灯管理系统笔记
查看>>
Hadoop MapReduce编程 API入门系列之wordcount版本3(七)
查看>>
前端html及标签
查看>>
day2-mysql基本命令和数据类型
查看>>
早上好~
查看>>
【Oracle】Oracle锁表处理
查看>>
CSS垂直翻转/水平翻转提高web页面资源重用性
查看>>
php-7.1.0 rpm包制作
查看>>
configparser模块
查看>>
SET方法内存管理
查看>>
3D数学读书笔记——矩阵基础
查看>>
jdk1.5多线程Lock接口及Condition接口
查看>>
四则运算分析题
查看>>
开博纪念
查看>>
(转)SQL一次性插入大量数据
查看>>