Adding a client event handler to tags other than the tagkey

Discussion in 'ASP .Net' started by Nathan Sokalski, Nov 1, 2007.

  1. 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.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Nov 1, 2007
    #1
    1. Advertising

  2. "Nathan Sokalski" <> wrote in message
    news:...

    [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


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Nov 1, 2007
    #2
    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. Replies:
    3
    Views:
    632
  2. Replies:
    0
    Views:
    511
  3. Replies:
    1
    Views:
    716
    Damien
    Feb 22, 2007
  4. Zoe Hart
    Replies:
    1
    Views:
    375
    Scott Wisniewski
    Jan 8, 2004
  5. Nathan Sokalski

    Adding a client event handler to tags other than the tagkey

    Nathan Sokalski, Nov 1, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    114
    Nathan Sokalski
    Nov 1, 2007
Loading...

Share This Page