private static bool SubmitState = false ;
protected void Page_Load( object sender, EventArgs e)
... {
//判断页面是否初始化以及提交的状态
if (IsPostBack && SubmitState)
...{
//从委托队列中删除原始事件
this.Button1.Click -= new EventHandler(Button1_Click);
this.Button1.Click += new EventHandler(kenButton1_Click);
}
}
// 重复提交事件
private void kenButton1_Click( object sender, EventArgs e)
... {
Response.Write("请不要重复提交,或者刷新");
}
// 提交
protected void Button1_Click( object sender, EventArgs e)
... {
Response.Write("提交成功");
SubmitState = true;
this.Button1.Click -= new EventHandler(Button1_Click);
this.Button1.Click += new EventHandler(kenButton1_Click);
}