Hi folks,
I am trying to prevent multiple postbacks from a button. When user clicks the button it becomes disabled but still i end up having multiple entries of same data in the database. Is anything wrong the way I am disabling my button ?
StringBuilder sbValid = new StringBuilder();
sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { ");
sbValid.Append("if (Page_ClientValidate('RequiredFields') == false) { return false; }} ");
sbValid.Append("this.value = 'Please wait...';");
sbValid.Append("this.disabled = true;");
//sbValid.Append("this.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());
RequiredFields is my validation group.