ASP.NET 2.0 Personal Web Site Starter Kit 主题的动态切换(增加八种主题)
第一次发贴,和各位高手见个面。
主题切换代码
在web.config文件中:
<pages theme="White"/>
在Default.aspx.cs文件中:
主题切换代码
在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文件中:{
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;
}
}
public void Page_PreInit()
{
this.Theme = (string)(Session["Theme"]);
}
{
this.Theme = (string)(Session["Theme"]);
}
下载: https://files.cnblogs.com/zhhui/PersonalStarterKitExportedTemplatesByZhhui.rar