Disable Submit button after submit information
Here we have to discuss the ie: how to disable the submit button after you submit the details for example: user are sending some value to database or storing user information so after storing the information i have to disable the submit button to avoid duplicate insertion ie: insert two or more times.
protected void Page_Load(object sender, EventArgs e)
{
string clickHandler = string.Format(
"document.body.style.cursor = 'wait'; this.value='Please wait...'; this.disabled = true; {0};",
this.ClientScript.GetPostBackEventReference(Button1, string.Empty));
Button1.Attributes.Add("onclick", clickHandler);
}
protected void Button1_Click(object sender, EventArgs e)
{
// Emulate a lengthy process of 10 seconds...
TimeSpan waitTime = new TimeSpan(0, 0, 0, 10);
System.Threading.Thread.Sleep(waitTime);
Response.Write("Button1_Click fired
");
}
Read more »