I have a button that is disabled by default, but gets enabled (or not disabled?) through JavaScript, but it’s not actually doing anything (i.e., posting) when I click it. Relevant code:
<asp:Button runat="server" ID="btnLoad" Text="Load"
OnClick="btnLoad_Click" Enabled="False"/>
Enabled through:
var btnLoad = $get("<%= btnLoad.ClientID %>");
btnLoad.disabled = false;
I hooked up another button to post back and enable the original button (btnLoad) on the server, and that seemed to do the trick. So it seems like it’s something with the button being enabled on the client, but not on the server. I suppose there’s nothing I can do except force a post back to enable the button? I’m not sure why I’m still posting this question now, but I will anyway 🙂
It’s because the server thinks “oh, that button is disabled, I’ll ignore that message”.
The best way would be to enable it server-side, then disable it with JavaScript on the page (put a
<script>tag at the top of the page) – and then later re-enable it as you do now.