How do I change the BackColor of the textbox area in an asp.net DropDownList?
How do I change开发者_开发百科 the BackColor of the textbox area in an asp.net DropDownList from white to another color? The Backcolor property changes only the drop down section.
You can change the background color of a tag with the following:
select {
background-color: #ff0000;
border: 1px solid #ff0000; /* if you want a different border */
}
Note: IE's styling differs from Firefox though.
You can do this via an external stylesheet and target the DropDownList's ID, or you can add the CSS property via code, like so:
DropDownList.Attributes.Add("style", "background-color: #FF0000")
But as Nick pointed out, you may not get your desired result, because form elements inherit from native operating system controls.
精彩评论