ASP. NET prevent repeated button clicks
First, add enableeventvalidation = "false" in <% @ Page %> ".
Btnok is the ID of the submit button. Add the callback method to the page_load event. btnok_click is the server code to be implemented after submission. The overall implementation process is relatively simple.
// Make the button unavailable and callback the server event
Protected void page_load (Object sender, eventargs E)
{
This. btnok. attributes. add ("onclick", clientscript. getpostbackeventreference (btnok, "click") + "; this. disabled = true; this. value = 'submitting... ';");
}
// Button processing method (51aspx.com)
Protected void btnok_click (Object sender, eventargs E)
{
System. Threading. thread. Sleep (2000 );
Clientscript. registerstartupscript (GetType (), "btncommit", "alert ('submitted successfully !!! '); ", True );
}