Posted on 2004-10-08
I tried this question in Web Dev yesterday and got no response so...
1. When a checkbox is checked, a textbox becomes "enabled"...when unchecked, "disabled". This works fine.
2. When a checkbox is checked, a checkboxlist (an array of checkboxes) becomes "enabled"...when unchecked, "disabled". This works fine, UNLESS I set the .Disabled property of the checkboxlist to =true in the code-behind.
Now, I am setting the .Disabled property =true to both the textbox and the checkboxlist in the code-behind on page_load. This renders the following HTML:
<td colspan="2"><a name="2"><textarea name="txtCSAS" rows="2" id="txtCSAS" disabled="disabled" class="normalText"></textarea></a></td>
Checkboxlist (one of the checkboxes):
<td><span disabled="disabled"><input id="chklstMB_0" type="checkbox" name="chklstMB:0" disabled="disabled" /><label for="chklstMB_0">MBTest 0</label></span></td>
The difference in the rendered HTML is that when I set the .Disabled property =true in the code-behind, disabled="disabled" is rendered. When I don't, then no disabled property is rendered.
textBox.disabled=false; or textBox.disabled=true;
Checkboxlist (iterate thru the array of form "input" controls):
arr[i].disabled=false; or arr[i].disabled=true;