One of the problems with web forms is when user clicks on Submit button several times, it will do multiple submissions. To prevent this we can easily use client side script to disable the Submit button. But then next problem you face after disabling the Submit button is to do the PostBack (after disabling the Submit button it stops the page PostBack happens).
I came across an article which shows how you can get around this problem by calling a client side function. Hope this would help you guys if facing the same problem like I did.
client side function (Page_DoPostBack) as follows
System.Text.StringBuilder sbValid = new System.Text.StringBuilder();
sbValid.Append("if (typeof(Page_DoPostBack) = = 'function') { ");
sbValid.Append("if (Page_DoPostBack () == false) { return false; }} ");
sbValid.Append("this.disabled = true;");
sbValid.Append("document.all.btnSubmit.disabled = true;");
//GetPostBackEventReference obtains a reference to a client-side script function that causes the server to post back to the page.
sbValid.Append(this.Page.GetPostBackEventReference(this.btnSubmit));
sbValid.Append(";");
this.btnSubmit.Attributes.Add("onclick", sbValid.ToString());
I came across an article which shows how you can get around this problem by calling a client side function. Hope this would help you guys if facing the same problem like I did.
client side function (Page_DoPostBack) as follows
System.Text.StringBuilder sbValid = new System.Text.StringBuilder();
sbValid.Append("if (typeof(Page_DoPostBack) = = 'function') { ");
sbValid.Append("if (Page_DoPostBack () == false) { return false; }} ");
sbValid.Append("this.disabled = true;");
sbValid.Append("document.all.btnSubmit.disabled = true;");
//GetPostBackEventReference obtains a reference to a client-side script function that causes the server to post back to the page.
sbValid.Append(this.Page.GetPostBackEventReference(this.btnSubmit));
sbValid.Append(";");
this.btnSubmit.Attributes.Add("onclick", sbValid.ToString());
Free Classified Ads in Dubai
ReplyDeleteDescription: DubaieClassifieds advertisements and Yellow Pages. Post your ADs for Jobs in dubai, Accommodation, Car Lift, Buy and Sell Items, Used Cars, Household Items, Free Hold Property.
http://www.dubaieclassified.com