通过web.config文件设置页面主题

编程入门 行业动态 更新时间:2024-10-13 08:25:33
本文介绍了通过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文件设置页面主题

本文发布于:2023-11-02 00:27:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550846.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   文件   主题   web   config

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!