Running javascript when a Radiobutton is changed

R

Robert Wagner

I have several server side RadioButtons on my page that are all in a group.
What I want is that when the state of the radiobutton group changes (or of
an individual one) that a javascript is run. (It doesn't matter, but the
javascript will disable a textbox).

How can I do this on the client side only, no postback. With standard HTML,
you would add an onClick attribute to the radio tag, however I cannot figure
out how to add it to the RadioButton WebControl.
 
G

Giorgio Parmeggiani

Hi
I have several server side RadioButtons on my page that are all in a group.
What I want is that when the state of the radiobutton group changes (or of
an individual one) that a javascript is run. (It doesn't matter, but the
javascript will disable a textbox).

this.RadioButton1.Attributes.Add("OnClick", "javascript:myFunction()");

Ciao
Giorgio
 
R

Robert Wagner

Thank you for that. Would have though you can do it on the "asp" side of
things, or through the visual IDE, but oh well.
 

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

Top