08.19.09
Javascript: To prevent or disable double click of button
Dim sb As New System.Text.StringBuilder()
sb.Append(“if (typeof(Page_ClientValidate) == ‘function’) { “)
sb.Append(“if (Page_ClientValidate() == false) { return false; }} “)
sb.Append(“this.value = ‘Please Wait…’;”)
sb.Append(“this.disabled = true;”)
sb.Append(Me.Page.GetPostBackEventReference(Me.btnSubmit))
sb.Append(“;”)
btnSubmit.Attributes.Add(“onclick”, sb.ToString())
Sayee Ahmed said,
September 1, 2009 at 12:42 pm
thank you very much for your post , its save my day . I have extended your script .
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(“if (typeof(Page_ClientValidate) == ‘function’) { “);
sb.Append(“if (Page_ClientValidate() == false) { return false; }} “);
sb.Append(“this.value = ‘Please Wait…’;”);
sb.Append(“this.disabled = true;”);
sb.Append(Page.GetPostBackEventReference(this.btnSaveTransaction));
sb.Append(“;”);
btnSaveTransaction.Attributes.Add(“onclick”, “javascript:if(confirm(‘Do you want to save this record?’)== false) return false;” + sb.ToString());