Avoiding Button Double Click - AJAX
-
currently i m using asp.net 2005 with c# (framework 2.0). i want to restrict the user to click the save button twice or more than that. Using ajax, i implemented it
<ajaxToolkit:AnimationExtender ID="Anibtnsave" runat="server" TargetControlID="btnsave">
<Animations>
<OnClick>
<EnableAction Enabled="false" /></OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>the above block will disable the button. its working fine. but i used few validation controls (ajaxToolkit:ValidatorCalloutExtender). when i click the button the validation pop-ups and also button getting disable. please help me. - KARAN
-
currently i m using asp.net 2005 with c# (framework 2.0). i want to restrict the user to click the save button twice or more than that. Using ajax, i implemented it
<ajaxToolkit:AnimationExtender ID="Anibtnsave" runat="server" TargetControlID="btnsave">
<Animations>
<OnClick>
<EnableAction Enabled="false" /></OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>the above block will disable the button. its working fine. but i used few validation controls (ajaxToolkit:ValidatorCalloutExtender). when i click the button the validation pop-ups and also button getting disable. please help me. - KARAN
Try this: private void checkButtonDoubleClick(Button button) { System.Text.StringBuilder sbValid = new System.Text.StringBuilder(); sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { "); sbValid.Append("if (Page_ClientValidate() == false) { return false; }} "); sbValid.Append("this.value = 'Please wait...';"); sbValid.Append("this.disabled = true;"); sbValid.Append(this.Page.ClientScript.GetPostBackEventReference(button, "")); sbValid.Append(";"); button.Attributes.Add("onclick", sbValid.ToString()); } Copied from here http://forums.asp.net/t/1362149.aspx[^]
-
Try this: private void checkButtonDoubleClick(Button button) { System.Text.StringBuilder sbValid = new System.Text.StringBuilder(); sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { "); sbValid.Append("if (Page_ClientValidate() == false) { return false; }} "); sbValid.Append("this.value = 'Please wait...';"); sbValid.Append("this.disabled = true;"); sbValid.Append(this.Page.ClientScript.GetPostBackEventReference(button, "")); sbValid.Append(";"); button.Attributes.Add("onclick", sbValid.ToString()); } Copied from here http://forums.asp.net/t/1362149.aspx[^]
Nice ideas in this thread. I like.
-
Try this: private void checkButtonDoubleClick(Button button) { System.Text.StringBuilder sbValid = new System.Text.StringBuilder(); sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { "); sbValid.Append("if (Page_ClientValidate() == false) { return false; }} "); sbValid.Append("this.value = 'Please wait...';"); sbValid.Append("this.disabled = true;"); sbValid.Append(this.Page.ClientScript.GetPostBackEventReference(button, "")); sbValid.Append(";"); button.Attributes.Add("onclick", sbValid.ToString()); } Copied from here http://forums.asp.net/t/1362149.aspx[^]
great arun. thanks a lot. also the same i would like to apply for an dropdownlist. because according to the selection of dropdown value, i m changing the button textvalue. according to the text value i m calling different functions.so when user select the dropdownlist item, it take some time. during that time, user should not click the button obviously. so i want to disable the button while user selecting item from dropdownlist until the text changes. how to achieve it? help me - KARAN