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

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

  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. 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. JD
    Replies:
    5
    Views:
    11,727
    NetArchitect
    Aug 8, 2007
  2. Patrick.O.Ige
    Replies:
    5
    Views:
    19,180
    Patrick.O.Ige
    Jun 19, 2005
  3. Nathan Sokalski

    Adding more than text to a CheckBoxList

    Nathan Sokalski, Feb 19, 2010, in forum: ASP .Net
    Replies:
    2
    Views:
    1,228
    Nathan Sokalski
    Feb 21, 2010
  4. Steven D'Aprano
    Replies:
    0
    Views:
    116
    Steven D'Aprano
    Dec 23, 2013
  5. Replies:
    3
    Views:
    98
    Gary Herron
    Dec 23, 2013
Loading...

Share This Page