通过web.config文件设置页面主题 [英] Setting page theme through web.config file

查看:130
本文介绍了通过web.config文件设置页面主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我需要将主题设置为我当前的项目

当用户从下拉列表中选择主题时,主题名称存储在会话中

当用户选择主题时,必须使用web.config文件将其应用于项目



所以,我的问题是通过web.config设置页面主题主题名称存储在session

Hello,
I need to set the themes to my current project
when user selects the theme from dropdown theme name is stored in a session
When user selects the theme it must be applied to project by using web.config file

so,my question is setting the page theme through web.config where the theme name is stored in session

推荐答案

这里你必须使用每一页的 Page_PreInit()事件。你不能这样做使用web.config文件进行动态主题分配。请尝试如下。



Here you have to use each and every page's Page_PreInit() event.You cannot do this kind of dynamic theme assignment by using web.config file.So try is as below.

protected void Page_PreInit(object sender, EventArgs e)
{
    switch (YourSessionTheme["theme"])
    {
        case "Blue":
            Page.Theme = "BlueTheme";
            break;
        case "Pink":
            Page.Theme = "PinkTheme";
            break;
    }
}





请阅读以获取更多信息: 以编程方式应用ASP.NET主题


这篇关于通过web.config文件设置页面主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆