开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜