This is what I need to implement for one of my project. I am using Ajax and if user tries to hit the submit the button more than once, only the very first request should submit to server and all other requests shouldn't make any request. So, for this I need to disable the button when first time click on button and enable it after processed. But, I faced a problem that when I try to disable the button in javascript of client side click event then the postback event not raising at all. There are couple of ways we can implement this. First, I tried from server side code.
Solution 1:
- btnSubmit.Attributes.Add("onclick","javascript:" + btnSubmit.ClientID + ".disabled=true;" + this.GetPostBackEventReference(btnSubmit));
Solution 2:
- OnClientClick='javascript:this.disabled=Page_ClientValidate("");' UseSubmitBehavior="false"
Hope this gives you the enough idea. Like to know what you think.
No comments:
Post a Comment