views:

33

answers:

2

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.

+5  A: 

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.

Neurofluxation
+1  A: 

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.

Intelekshual
I think it's only fair that I vote you up - you covered the other direction :)
Neurofluxation