0

I have a dropdown where I need to set the forecolor of the first item to some color. I tried the following script, but does not work.

dropdown.DataSource =.....
dropdown.DataBind();
ListItem li = new ListItem();
li.Text = "Feedback Type";
li.Value = string.Empty;
li.Attributes.Add("style", "Color: Red");
dropdown.Items.Insert(0, li);

Any help appreciated. Thanks

Manali
  • 53
  • 7
  • Try `li.Attributes.CssStyle.Add("color", "red");` instead of how you tried to add color red. Just to clarify, this only changes the color of the text of the item in the list. This will not change the color of the selected text in the dropdown. Hope this helps. – dvo May 16 '19 at 20:54
  • Yeah, I tried it, it applies forecolor the 1st item, but I need it for the selected item(kind of watermark). – Manali May 17 '19 at 01:09

0 Answers0