Solved

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

Posted on 2008-09-30
7
354 Views
Last Modified: 2012-05-05
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
Comment
Question by:mrl72
  • 4
7 Comments
 
LVL 18

Expert Comment

by:David Robitaille
ID: 22606102
disable the check box during page load using checkbox1.enabled=false instead
0
 

Author Comment

by:mrl72
ID: 22606197
That doesn't work, the checkbox remains disabled.
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 22606280
is the checkbox is into some update panel or something?
submit the aspx code please
0
 
LVL 18

Accepted Solution

by:
David Robitaille earned 500 total points
ID: 22607783
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
 
LVL 18

Expert Comment

by:David Robitaille
ID: 22742876
So did that works?
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now