ASP.NET CheckBox Control

T

Tracey

I have found that the <asp:checkbox> control is not
respecting the disabled attribute while the <asp:textbox>
and other controls are respecting it. Does anybody know if
this is a known bug and if so, what it's number is? Can
anybody else reproduce this problem? I've included some
simple code below. Here is the Form:

<form id="frmTest" method="post" runat="server">

<asp:CheckBox ID="chkTest" Runat="server" Enabled="False"
Text="chkTest"></asp:CheckBox>

<asp:TextBox ID="txtTest" Runat="server"
Enabled="False">txtTest</asp:TextBox>

<asp:CheckBox ID="chkTryIt" Runat="server" Enabled="True"
Text="chkTryIt"></asp:CheckBox>

</form>

And here is some client side script used to flip flop
between enabled and disabled. Notice how the textbox
respects the disabled attribute, but for some reason the
checkbox doesn't?

Sub chkTryIt_OnClick

document.getElementById("chkTest").disabled = _
(document.getElementById("chkTryIt").checked = False)

document.getElementById("chkTest").checked = _
(document.getElementById("chkTryIt").checked = True)

document.getElementById("txtTest").disabled = _
(document.getElementById("chkTryIt").checked = False)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top