我的sytle设置成这样
<style type="text/css">
body {background:url(images/<%=Themesurl%>/allbg.jpg) no-repeat right <%=ConfigColor%>;}
</style>Themesurl和ConfigColor都是在数据库里写好的.
运行显示成功.查看html代码是这样
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
</style>
然后我点击了一个超链接或者其它需要postback的按钮.页面刷新后就没有取到变量值了
html代码成这样了
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
</style>???
<style type="text/css">
body {background:url(images/<%=Themesurl%>/allbg.jpg) no-repeat right <%=ConfigColor%>;}
</style>Themesurl和ConfigColor都是在数据库里写好的.
运行显示成功.查看html代码是这样
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
</style>
然后我点击了一个超链接或者其它需要postback的按钮.页面刷新后就没有取到变量值了
html代码成这样了
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
</style>???
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
</style>
然后我点击了一个超链接或者其它需要postback的按钮.页面刷新后就没有取到变量值了
html代码成这样了
<style type="text/css">
body {background:url(images//allbg.jpg) no-repeat right ;}
================
两行一样的东西
<style type="text/css" id="styleconfig">
body {background:url(images/Themes_2/allbg.jpg) no-repeat right #316c90;}
</style>
你好.我都是通过全局变量
public string Themesurl;
public string ConfigColor;viewstate写在哪里?
page_load()
{
Themesurl = func();
}
如果用viewstate,会增加页面大小,多占网络传输带宽。用法
page_load()
{
if(!Page.IsPostBack)
{
ViewState["Themesurl"] = func();
}
}
取:Themesurl=ViewState["Themesurl"].ToString();
谢了!我把代码写在ispostback外就行了