onchange and onclick event

Discussion in 'ASP .Net' started by saurabh, Jul 28, 2006.

  1. saurabh

    saurabh Guest

    Hi in my code i have a line

    Rad2.Attributes.Add("onclick","onchange2();"); This is working
    perfectly fine.When user clicks the Rad2 radiobutton onchange2();
    function gets executed.

    but in case i replace this line with
    Rad2.Attributes.Add("onchange","onchange2();");

    i face the problem. onchange2() function doesnt get executed at all in
    case the check of radio button changes.

    does anybody has any idea what could be the possible cause?
     
    saurabh, Jul 28, 2006
    #1
    1. Advertisements

  2. Saurabh,

    Even I did something similar in the past and I think that since it is a
    RadioButton the Attribute should be "onclick" since this event(onclick)
    changes the value of this control and the same is true with CheckBox.

    But "onchange" event works for TextBox control.

    Try "onchange" with TextBox it should work, but for RadioButton and
    CheckBox i think "onclick" is the relevant event.

    -Rishabh
     
    rishabhshrivastava, Jul 28, 2006
    #2
    1. Advertisements

  3. saurabh

    saurabh Guest

    no, this is for sure that onchange event exists for radio button ..i
    have seen it on various sites...jst dont know y it is not executing tht
    function...
     
    saurabh, Jul 28, 2006
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.