I try to change color of every item in my DropDownList. Was try on DataBound, and PreRender, but it doesn't work. Problem is becouse i can't add any atribute to <option>. I try in debuger, and attributes are added, but they don't show HTML. I try to change item.Text, and it works. So :) ?
I have piece code like this:
public void ddlColors_DataBound(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
foreach (ListItem item in ddl.Items)
{
item.Attributes.Add("style", "color:" + item.Text.Trim());
item.Text = "text";
}
}