Adding a client event handler to tags other than the tagkey

  • Thread starter Nathan Sokalski
  • Start date
N

Nathan Sokalski

I want to add a client-side onchange event to the input tag generated by a
CheckBox Control. However, because the CheckBox generates the following set
of tags:

<span><input/><label></label></span>

If I try to add the onchange attribute to the CheckBox Control it is added
to the span tag instead of the input tag (I understand why, so there is no
need to explain that). The only way I can think of to add a client-side
event handler to the input tag would be to use the RegisterStartupScript
method to create JavaScript that adds an event handler. I know the ID of the
input tag, but I am having trouble getting the JavaScript correct to add the
eventhandler. Can someone help me? Thanks.
 
M

Mark Rae [MVP]

[cross-posting removed]
I want to add a client-side onchange event to the input tag generated by a
CheckBox Control.

A CheckBox webcontrol renders as an <input type="checkbox" /> control, which
doesn't have an onchange event so you're wasting your time trying to wire
one up...

<input type="checkbox" /> controls have the following object-specific event
handler properties:

onblur
onclick
onfocus
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top