div层在后台可以控制吗?
div 在前台用Js控制显示,默认none;在后台如何控制显示?
尤其在页面刷新时,原本已经显示了,但是刷新后div会回到默认的none,不显示了。如何解决?
------解决方案--------------------前台
<div id= "Div1 " style= " <%=DivVisiable %> ; ">
后台
public string DivVisiable
{
get
{
if (ViewState[ "DivVisiable "] == null)
return "display:none; ";
else
return (string)ViewState[ "DivVisiable "];
}
set { ViewState[ "DivVisiable "] = value; }
}
DivVisiable = "display:block; ";
or DivVisiable = "display:none; ";