Change forecolor for individual listitems in CheckBoxList

  • Thread starter Thread starter Eric Robishaw
  • Start date Start date
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
 
Back
Top