Solved

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

Posted on 2008-09-30
7
357 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

867 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

24 Experts available now in Live!

Get 1:1 Help Now