onchange and onclick event

S

saurabh

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?
 
R

rishabhshrivastava

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
 
S

saurabh

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

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top