防止按鈕重覆發送-Asp.net by C#

防止按鈕重覆發送

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Threading;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        btnSend.Attributes["onclick"] = "this.disabled=disabled;" + this.Page.ClientScript.GetPostBackEventReference(btnSend, "");
    }

    protected void btnSend_Click(object sender, EventArgs e)
    {
        Thread.Sleep(3000);
        Response.Write(this.txtData.Text);
    }
}