Hi Amol111,
I have checked your code is working.
Check the below code.
HTML
<script type="text/javascript">
function disableBtn(btnID, newText) {
Page_IsValid = null;
if (typeof (Page_ClientValidate) == 'function') {
Page_ClientValidate();
}
var btn = document.getElementById(btnID);
var isValidationOk = Page_IsValid;
if (isValidationOk !== null) {
if (isValidationOk) {
btn.disabled = true;
btn.value = newText;
}
else {
btn.disabled = false;
}
}
else {
//setTimeout("setImage('" + btnID + "')", 10);
btn.disabled = true;
btn.value = newText;
}
}
</script>
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Font-Bold="true"
Text="Submit" ToolTip="Submit" OnClientClick="disableBtn(this.id, 'Submitting...')"
UseSubmitBehavior="false" CssClass="btn btn-block btn-success" />
<br />
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Font-Bold="true"
Text="Save" ToolTip="Save" OnClientClick="disableBtn(this.id, 'Saving...')" UseSubmitBehavior="false"
CssClass="btn btn-block btn-success" />
Code
protected void btnSubmit_Click(object sender, EventArgs e)
{
}
protected void btnSave_Click(object sender, EventArgs e)
{
}
Screenshot
If you want to disable all the Button while Post Back to restrict user to click on other buttons, then instead of disabling button show loader to user.
Refer below link for more details.