Running javascript when a Radiobutton is changed

Discussion in 'ASP .Net' started by Robert Wagner, Nov 5, 2003.

  1. 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.
    Robert Wagner, Nov 5, 2003
    #1
    1. Advertising

  2. 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
    Giorgio Parmeggiani, Nov 5, 2003
    #2
    1. Advertising

  3. 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.

    "Giorgio Parmeggiani" <> wrote in message
    news:...
    > 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
    >
    >
    >
    Robert Wagner, Nov 6, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    5
    Views:
    5,950
    Joaquin Corchero
    Mar 15, 2005
  2. Replies:
    1
    Views:
    669
    Rosanne
    Oct 11, 2005
  3. Dmitry Duginov
    Replies:
    8
    Views:
    1,751
    Dmitry Duginov
    Dec 13, 2007
  4. Replies:
    6
    Views:
    105
  5. mxbrunet
    Replies:
    1
    Views:
    199
Loading...

Share This Page