How do you enable checkbox from code behind that is already in a disabled state?

I have an asp checkbox on a form that is disabled during page load using CheckBox1.InputAttributes.Add("disabled", "disabled"). On the form is a text box which is filled via a server side event. In that event the checkbox should then be enabled. I have tried using checkbox1.enabled=true or CheckBox1.InputAttributes.Add("disabled", "") but the checkbox remains disabled.
mrl72Asked:
Who is Participating?
 
David RobitailleConnect With a Mentor Analyst ProgrammerCommented:
i just think about it, do you use a
<input id="Checkbox1" type="checkbox" />
or a
<asp:CheckBox ID="CheckBox1" runat="server" />
for code beind to work, you need the second
Also :
make sure you put that if in the page load, becaus the page is loaded at each post back...
 

If Not Page.IsPostBack Then 
    checkbox1.enabled=false 
end if 

Open in new window

0
 
David RobitailleAnalyst ProgrammerCommented:
disable the check box during page load using checkbox1.enabled=false instead
0
 
mrl72Author Commented:
That doesn't work, the checkbox remains disabled.
0
 
David RobitailleAnalyst ProgrammerCommented:
is the checkbox is into some update panel or something?
submit the aspx code please
0
 
David RobitailleAnalyst ProgrammerCommented:
So did that works?
0
All Courses

From novice to tech pro — start learning today.