can JavaScript change web form control property?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
try setting the radio button's disabled property like:

document.Form1.C.disabled = true;

HTH,
T
 
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
 
Thank you very much. It seems working when I reset everything back to my
original client based operation.

David
 
Back
Top