Posted on: 7/2/2015 11:57:38 AM | Views : 690

Ah - that title should be "Double click prevention on button....."
I have a legacy .Net 2.0 Webforms app that has had some code in it for as long as I can remember to prevent an order submission button being clicked twice.
The code in use is as follows  :
'***** This is the code for a Single-Click button 'Prevents a user from submitting a page more than once. Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder 'This forces the page validation, if any, to execute. sb.Append("if (typeof(Page_ClientValidate) == 'function') { ") sb.Append("if (Page_ClientValidate() == false) { return false; }} ") 'Prevent the button from being pressed a second time. sb.Append("this.disabled = true;") 'change the button image sb.Append("this.src = '/images/buttlargecheckoutpayment_grey.jpg';") 'Forces the page to postback. sb.Append(Page.GetPostBackEventReference(btnPayment)) ...

Go to the complete details ...