Javascript disable checkbox not working after codebehind disable

I have a simple javascipt which enables/disables some checkboxes when another checkbox ticked/unticked. This works fine, however, in some instances when by page is loaded my code behind disables the same check boxes. When this happenes my original check box nolonger seems to have any influence in enableing or disabling - there is no error and all the elements seem to be found by the javascript - it just doesn’t enable/disable the checkboxes.

Does the code behind disable method do something a bit more perminant to disable the check boxes?



eh? Its a .net issue!

please take some reference from simply JavaScript book that is published by sitepoint.

No it doesn’t, look at the source code, here is an example:

ASP.Net Source:

<asp:CheckBox ID="CheckBox1" runat="server" />
<asp:CheckBox ID="CheckBox2" runat="server" Enabled="false" />

Generated HTML:

<input id="CheckBox1" type="checkbox" name="CheckBox1" />
<span disabled="disabled"><input id="CheckBox2" type="checkbox" name="CheckBox2" disabled="disabled" /></span>

Simple answer - .net disables a form object completely!

Have you looked at the HTML source code?