I'm trying to change the text properties within a list box when the list item is checked. Currently if i check an item it will print a message in the label so at least its registering a selection. Any ideas on how i can change the text properties i.e. if an item is selected then change the color of the text on the selected item from default black to red?
for (int i = 0; i < checklist.Items.Count; i++)
{
if (checkist.Items[i].Selected)
{
lbltest.Text = "yayee";
//checklist.Items[i].Attributes.CssStyle(); maybee ??
}
}
Because
CheckboxList.Items
is a collection ofListItems
I think your best bet is to useCssStyle
to add individual style attributes.Any other modifications, such as underline or bold could be made in a similar fashion. You just have to use standard CSS: