I've seen a few posts but I cannot get this to work. I have a "Save" button setup as a LinkButton. When they click on it, I want it to fire the postback but also disable the button so they cannot click on it numerous times. I've tried disabling the button via javascript, ajax update panels but nothing is working. Even in the Javascript I did an alert so I know it was getting to the JS function but it never disabled the button. Here is the structure of my "toolbar" of buttons. Any thoughts on how to structure it?
<div class="navbar-collapse collapse navbar-right" id="main_navbar">
<ul class="nav navbar-nav">
<li id="liNew" runat="server">
<asp:LinkButton ID="lnkbtnNew" CssClass="" runat="server" ToolTip="Click to add a new record" TabIndex="3">
<span class ="fa fa-plus"></span>
<span class=""></span>
<span class="">~New~</span>
</asp:LinkButton>
</li>
<li id="liSave" runat="server">
<asp:LinkButton ID="lnkbtnSave" CssClass="" runat="server" ToolTip="Click to save this record" TabIndex="6">
<!-- OnClientClick="javascript:DisableButton(this);" -->
<span class="fa fa-floppy-o"></span>
<span class=""></span>
<span class="">~Save~</span>
</asp:LinkButton>
</li>
</ul>
</div>
Perhaps I just don't know how to structure the UpdatePanel but if I put this entire Div in it, nothing seems to fire.
The Javascript I tried is below and then I added to the LinkButton the attribute OnClientClick="javascript:DisableButton(this);"
function DisableButton(e) {
var x = document.getElementById('lnkbtnSave');
if (x != null) {
x.disabled = true;
alert("disabled");
}
return false;
}
Tried return true or return false above and nothing ever disables the control on the screen.