探索与发现

研究java技术

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  83 随笔 :: 0 文章 :: 109 评论 :: 0 Trackbacks
1. Using ViewState and Session


public partial class _Default : System.Web.UI.Page
{
private bool _refreshState;
private bool _isRefresh;
public bool IsRefresh
{
get
{
return _isRefresh;
}
}
protected override void LoadViewState(object savedState)
{
object[] allStates = (object[])savedState;
base.LoadViewState(allStates[0]);
_refreshState = (bool)allStates[1];
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
}

protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] allStates = new object[2];
allStates[0] = base.SaveViewState();
allStates[1] = !_refreshState;
return allStates;
}

protected void Button2_Click(object sender, EventArgs e)
{
if(!IsRefresh)
Response.Write("Thanx for visiting");
}
}


but still exist a problem,,when open two window.
posted on 2009-06-13 14:52 蜘蛛 阅读(163) 评论(0)  编辑  收藏 所属分类: SharePoint

只有注册用户登录后才能发表评论。


网站导航: