I have a disabled asp.Button, which I enable later with JavaScript. Like this
<asp:Button ID="btnSave" runat="server" Text="Save" Enabled="false" OnClientClick="; return ValidateFields();" OnClick="btnSave_Clicked" />
However, the “onclick” method is not rendered as html when the control is disabled. My work around is to add the following code in PageLoad.
btnSave.Attributes["onclick"] = "return ValidateFields();";
Is there a more convenient work around for this?
Thanks
You can use the html attribute for disabled
I assume you then make it enabled in clientside? if so then you can enable it with :