Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

856 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