zhhui.net

月明星稀,乌鹊南飞。绕树三匝,何枝可依?

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4 随笔 :: 0 文章 :: 5 评论 :: 7674 阅读
< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10
第一次发贴,和各位高手见个面。

主题切换代码

在web.config文件中:
    <pages theme="White"/>

在Default.aspx.cs文件中:
    public void Page_PreInit()
    
{
        
if (Request.Form != null && Request.Form.Count > 0)
            Session[
"Theme"= this.Request.Form[4].Trim();
        
else
            
if (Session["Theme"== null)
                Session[
"Theme"= "White";
        
this.Theme = (string)(Session["Theme"]);
    }

    
protected void Page_Load(object sender, EventArgs e)
    
{
        
foreach (ListItem li in dropTheme.Items)
        
{
            
if (li.Value.ToString() == (string)(Session["Theme"]))
                li.Selected 
= true;
            
else
                li.Selected 
= false;
        }

    }
在所有其它.cs文件中:
    public void Page_PreInit()
    
{
        
 this.Theme = (string)(Session["Theme"]);
    }

下载: https://files.cnblogs.com/zhhui/PersonalStarterKitExportedTemplatesByZhhui.rar

posted on   zhhui  阅读(3948)  评论(4)    收藏  举报
点击右上角即可分享
微信分享提示