Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

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.
0
mrl72
Asked:
mrl72
  • 4
1 Solution
 
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:
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:
So did that works?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now