62,046
社区成员
发帖
与我相关
我的任务
分享
//首先在<%@ Page %>中添加EnableEventValidation="false".
//btnOK是提交按钮的ID,在Page_Load事件中添加回调方法.btnOK_Click就是提交后要实现的服务端代码.
// 整体的实现过程还是比较简单的.使按钮不可用并回调服务端事件
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(Button1, "Click") + ";this.Disabled=true; this.value='提交中...';");
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "提交成功!";
System.Threading.Thread.Sleep(2000);
ClientScript.RegisterStartupScript(GetType(), "btnCommit", "alert('提交成功!!!');", true);
}
}