Adding CssClass property default to custom checkbox wraps with span tag

Discussion in 'ASP .Net Building Controls' started by TS, Jul 16, 2007.

  1. TS

    TS Guest

    i don't know why but when i set CssClass to a default value in the
    constructor for my checkbox control inherited from CheckBox, the rendered
    html wraps the checkbox with a span tag and puts the class attribute on it.

    I'm wondering why it does this?

    I need to add an onclick javascript event to the checkbox, but when i try to
    add it in AddAttributestoRender, it sticks the onclick call on the span tag.

    what do i need to do ?

    thanks
    TS, Jul 16, 2007
    #1
    1. Advertising

  2. Hi TS,

    From your description, you're meeting some problems when use the ASP.NET
    checkBox server control(custom control derived from it) ,correct?

    As for the ASP.NET checkbox Server control, it is an encapsulated one which
    doesn't 100% identical to the html checkbox input element. The <Span>
    wrapper tag is used to add some addtional features such as DisplayText, for
    standard html checkbox, it doesn't have "Text" setting. So when you want
    to use clientscript to manipulate the actual underlying html checkbox
    element inside the ASP.NET checkbox server control, you may need to
    manually query the checkbox element inside the <span> tag. Also, one way
    to get the html like checkbox element is to use the CheckBox html server
    control. Here are some web threads also discussing on this:


    http://www.thescripts.com/forum/thread449893.html

    http://forums.asp.net/p/541142/541562.aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Jul 17, 2007
    #2
    1. Advertising

  3. TS

    TS Guest

    thanks
    "Steven Cheng[MSFT]" <> wrote in message
    news:p...
    > Hi TS,
    >
    > From your description, you're meeting some problems when use the ASP.NET
    > checkBox server control(custom control derived from it) ,correct?
    >
    > As for the ASP.NET checkbox Server control, it is an encapsulated one

    which
    > doesn't 100% identical to the html checkbox input element. The <Span>
    > wrapper tag is used to add some addtional features such as DisplayText,

    for
    > standard html checkbox, it doesn't have "Text" setting. So when you want
    > to use clientscript to manipulate the actual underlying html checkbox
    > element inside the ASP.NET checkbox server control, you may need to
    > manually query the checkbox element inside the <span> tag. Also, one way
    > to get the html like checkbox element is to use the CheckBox html server
    > control. Here are some web threads also discussing on this:
    >
    >
    > http://www.thescripts.com/forum/thread449893.html
    >
    > http://forums.asp.net/p/541142/541562.aspx
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    >

    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    >
    TS, Jul 17, 2007
    #3
  4. Thanks for your reply TS,

    If you meet any new problem that need help, please feel free to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Jul 18, 2007
    #4
    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. shruds
    Replies:
    1
    Views:
    739
    John C. Bollinger
    Jan 27, 2006
  2. Fulio Open

    Can span include span?

    Fulio Open, Jun 26, 2009, in forum: HTML
    Replies:
    5
    Views:
    534
    dorayme
    Jun 26, 2009
  3. Stéphane Klein
    Replies:
    2
    Views:
    1,733
    John Nagle
    Mar 30, 2010
  4. Sky
    Replies:
    2
    Views:
    275
    Robert Koritnik
    Oct 1, 2004
  5. Rocky Moore

    Removing the <span> tag on a CheckBox?

    Rocky Moore, Mar 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    282
    Rocky Moore
    Mar 29, 2005
Loading...

Share This Page