Change forecolor for individual listitems in CheckBoxList

E

Eric Robishaw

I'm adding items to a CheckBoxList Control, and need the text in each
checkbox list item to be a specific color. Here's what I'm trying:

ListItem li = new ListItem(GroupName, GroupID);
li.Attributes.Add("ForeColor", GroupColor);
GroupList.Items.Add (li);

When viewing the produced HTML... there is no ForeColor attribute
being added. My guess is because each list item is really comprised
of two items: 1) CheckBox and 2) A label associated with it, and the
Attributes.Add is trying to add the forecolor atribute to the
CheckBox... not the label.

How can I get the text itself to a specified color?

I'd really like to use the CheckBoxList Control, if possible.

Do you think I need to derive a control from it, and override one of
the render methods?

Eric
 

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,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top