I am using a checkboxlist to bind some data from database. Each item in checkboxlist is set with a unique background color. I need to get the background color set to a selected item in the checkboxlist. For binding the colors I have used the code below
for (int i = 0; i < cbFilter.Items.Count; i++)
{
Color RandomColor = GetRandomColor();
string hexColorValue = ColorTranslator.ToHtml(RandomColor);
cbFilter.Items[i].Attributes.Add("style", "background-color:" + hexColorValue);
}
Please give a solution to fetch the background color of a selected item.
1 Answer