[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-09-30
7
Medium Priority
?
378 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
5 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 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