I have a set of ASP.NET controls:
<asp:LinkButton ID="Find"
ClientIDMode="Static"
runat="server"
CausesValidation="true"
OnClientClick="$('#Find').attr('disabled', 'disabled'); $('#SearchingLabel').show();">
<span>Search</span>
</asp:LinkButton>
<asp:Label ID="SearchingLabel"
ClientIDMode="Static"
runat="server"
Text="Searching..."
style="display: none;" />
and as you can see I'm consuming the OnClientClick
so that I can disable the Find
button and show the SearchingLabel
(and the JavaScript works without error BTW). Pretty basic stuff.
Further, surrounding the CausesValidation
attribute, I do have validation controls on the page, but there are no current validation errors.
However, even though I'm not returning false
from the JavaScript the page isn't posting back. I've even attempted to return true;
but that didn't change anything (not really that surprising but it was worth a try).
I look forward to your feedback!
It seems like you are disabling your button, before the postback.
You could try your page/script without the disabling part in it:
OnClientClick="$('#SearchingLabel').show();"
If this works, try it with a short delay:
OnClientClick="setTimeout(function() { $('#Find').attr('disabled', 'disabled'); }, 100); $('#SearchingLabel').show();"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With