动态应用主题
<system.web>
<profile>
<properties>
<add name="UserTheme"/>
</properties>
</profile>
</system.web>
<profile>
<properties>
<add name="UserTheme"/>
</properties>
</profile>
</system.web>
然后,在页面编写动态应用主题的方法。
//Web Application项目下的代码
using System.Web.Profile;
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request["theme"] != null)
{
switch (Request["theme"])
{
case "green":
ProfileBase.Properties["UserTheme"].DefaultValue = "Ch6_GreenTheme";
break;
case "pink":
ProfileBase.Properties["UserTheme"].DefaultValue = "Ch6_PinkTheme";
break;
}
Theme = (string)ProfileBase.Properties["UserTheme"].DefaultValue;
}
}
<%--以上在Application中的代码,哪位高手有更好一点的方法,请跟帖!谢谢--%>
//Website项目下的方法
<script runat="server">
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request["theme"] != null)
{
switch (Request["theme"])
{
case "green":
Profile.UserTheme = "Ch6_GreenTheme";
break;
case "pink":
Profile.UserTheme = "Ch6_PinkTheme";
break;
default:
break;
}
Theme = (string)Profile.UserTheme;
}
}
</script>
using System.Web.Profile;
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request["theme"] != null)
{
switch (Request["theme"])
{
case "green":
ProfileBase.Properties["UserTheme"].DefaultValue = "Ch6_GreenTheme";
break;
case "pink":
ProfileBase.Properties["UserTheme"].DefaultValue = "Ch6_PinkTheme";
break;
}
Theme = (string)ProfileBase.Properties["UserTheme"].DefaultValue;
}
}
<%--以上在Application中的代码,哪位高手有更好一点的方法,请跟帖!谢谢--%>
//Website项目下的方法
<script runat="server">
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request["theme"] != null)
{
switch (Request["theme"])
{
case "green":
Profile.UserTheme = "Ch6_GreenTheme";
break;
case "pink":
Profile.UserTheme = "Ch6_PinkTheme";
break;
default:
break;
}
Theme = (string)Profile.UserTheme;
}
}
</script>
<li><a href="ShowDynamicTheme.aspx?theme=green">Green Theme</a></li>
<li><a href="ShowDynamicTheme.aspx?theme=pink">Pink Theme</a></li>
<li><a href="ShowDynamicTheme.aspx?theme=pink">Pink Theme</a></li>