can JavaScript change web form control property?

G

Guest

I have written JavaScript and try to change the radio button property
(disenable other radio buttons) once click on it. But it does not work. For
example, I have radio buttons A, B, and C. A and B are in the same group AB.
When A is selected, C is enabled; otherwise, C is disabled. MY code is:

JavaScript:

function enableC(){
document.Form1.C.enabled = true;
}

function disenableC(){
document.Form1.C.enabled = false;
}

In asp.net codebehind:

rbtnA.Attributes.Add("onClick", "enableC()")
rbtnB.Attributes.Add("onClick", "disableC()")


What is wrong with it?
Can we use JavaScript in this way?
Of course, I can use it to perform calculation and set value to textbox in
this way.

Thank you for your any help.

David
 
A

Anthony Merante

try setting the radio button's disabled property like:

document.Form1.C.disabled = true;

HTH,
T
 
G

Guest

Thank you. But it does not work either.

David

Anthony Merante said:
try setting the radio button's disabled property like:

document.Form1.C.disabled = true;

HTH,
T
 
G

Guest

Thank you very much. It seems working when I reset everything back to my
original client based operation.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top