用户在 ASP.NET 中为 YAF 选择了 theme.css

User selected theme.css for YAF in ASP.NET
2021-11-25
  •  译文(汉语)
  •  原文(英语)

我有两个主要主题,一个是黑暗的,一个是用于论坛的光明,但是,ASP.NET Site.Master 的背景与这两个主题都不融合,我决定根据用户选择的论坛主题更改整个模板. 因此,浅色主题将为网站提供浅色背景,而深色主题将为网站提供深色背景.很简单,对吧?

我在 Site.Master 页面中有这个...

<link href='<%# HttpContext.Current.Session["theme"].ToString() %>' rel="stylesheet" type="text/css" />

...并且根据需要适用于 Forum.aspx(重命名为 Default.aspx),但是当导航到任何其他站点链接时,CSS 模板丢失了.

我可以做些什么来维护用户从整个网站的论坛资料中选择的模板?

解决过程1

我从这个问题中找到了答案.我不得不从 head 标签中删除 runat="server".

I have two primary themes, one dark, one light for the forum, however, with the background of the ASP.NET Site.Master not blending in with both I have decided to change the entire template predicated on what the forum theme the user chooses. So the light theme will have a light background for the site, and dark theme will have a dark background for the site. Pretty simple, right?

I have this in the Site.Master page ...

<link href='<%# HttpContext.Current.Session["theme"].ToString() %>' rel="stylesheet" type="text/css" />

... and that works for the Forum.aspx (renamed to Default.aspx) as desired, but when navigating to any other site link, the CSS template is lost.

What can I do to maintain the template the user selects from their forum profile throughout the entire site?

Solutions1

I found the answer from this question. I had to remove runat="server" from the head tag.

转载于:https://stackoverflow.com/questions/15238079/user-selected-theme-css-for-yaf-in-asp-net

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入