Adding more than text to a CheckBoxList

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Feb 19, 2010.

  1. I have a CheckBoxList and I want more than just text in some of the items.
    However, because the ListItem, which is used to add the CheckBoxes, does not
    allow child controls, I cannot find a way to do this. Any ideas? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Feb 19, 2010
    #1
    1. Advertisements

  2. "Nathan Sokalski" <> wrote in message
    news:...
    > I have a CheckBoxList and I want more than just text in some of the items.
    > However, because the ListItem, which is used to add the CheckBoxes, does
    > not allow child controls, I cannot find a way to do this. Any ideas?
    > Thanks.


    I can think of a few ways. One is to use a control like a Repeater that
    gives you full control of the HTML output and can be altered with each item
    quite easily. This is by taking control of the binding. Another option,
    perhaps, is to change the style and use CSS to deliver the other content
    (images?).


    --
    Peace and Grace,
    Greg

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    ************************************************
    | Think outside the box! |
    ************************************************
     
    Gregory A. Beamer, Feb 21, 2010
    #2
    1. Advertisements

  3. Interesting ideas, but unfortunately neither one will work. The Repeater
    would not work in my situation because I am not using DataBinding for the
    CheckBoxList, and the Repeater does not have the built-in properties for
    dealing with checkboxes that I like about the CheckBoxList. CSS will not
    work because there is no way to get the child controls into the ListItem,
    which means that in the generated HTML, the controls that I wanted to make
    child controls are outside of the table that the CheckBoxList generates
    (therefore, the "child" controls aren't really children at all). And without
    the "child" controls inside the same td tag as the generated input and label
    tag, CSS becomes pretty useless as far as putting the "child" controls where
    I want. Any other ideas?
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Gregory A. Beamer" <> wrote in message
    news:...
    >
    >
    > "Nathan Sokalski" <> wrote in message
    > news:...
    >> I have a CheckBoxList and I want more than just text in some of the
    >> items. However, because the ListItem, which is used to add the
    >> CheckBoxes, does not allow child controls, I cannot find a way to do
    >> this. Any ideas? Thanks.

    >
    > I can think of a few ways. One is to use a control like a Repeater that
    > gives you full control of the HTML output and can be altered with each
    > item quite easily. This is by taking control of the binding. Another
    > option, perhaps, is to change the style and use CSS to deliver the other
    > content (images?).
    >
    >
    > --
    > Peace and Grace,
    > Greg
    >
    > Twitter: @gbworld
    > Blog: http://gregorybeamer.spaces.live.com
    >
    > ************************************************
    > | Think outside the box! |
    > ************************************************
     
    Nathan Sokalski, Feb 21, 2010
    #3
    1. Advertisements

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. JD
    Replies:
    5
    Views:
    12,519
    NetArchitect
    Aug 8, 2007
  2. Madhanmohan S
    Replies:
    5
    Views:
    8,144
    Madhanmohan S
    Sep 3, 2004
  3. Patrick.O.Ige
    Replies:
    5
    Views:
    19,808
    Patrick.O.Ige
    Jun 19, 2005
  4. Michael
    Replies:
    4
    Views:
    722
    Matt Hammond
    Jun 26, 2006
  5. Nathan Sokalski

    Adding more than text to a CheckBoxList

    Nathan Sokalski, Feb 19, 2010, in forum: ASP .Net
    Replies:
    2
    Views:
    1,370
    Nathan Sokalski
    Feb 21, 2010
  6. Robert Klemme

    With a Ruby Yell: more, more more!

    Robert Klemme, Sep 28, 2005, in forum: Ruby
    Replies:
    5
    Views:
    440
    Jeff Wood
    Sep 29, 2005
  7. Bob Rashkin
    Replies:
    5
    Views:
    264
    Dennis Lee Bieber
    Dec 23, 2013
  8. Replies:
    3
    Views:
    258
    Gary Herron
    Dec 23, 2013
Loading...