ASPListBox DropdownList different entries set background color and font color 2009-09-30 from: Really interesting [ZU14. CN] Font size: "Big small"
- Abstract: On the HTML display page, for the HTML select, the server-side control DropDownList, sometimes need to vary depending on the situation, for some option items, set different colors and different background color, to show the difference, for the HTML control Select, is a light and easy As long as you specify a style, for server-side controls, because you cannot specify a style or CSS directly, you need to use Attributes to add
On the HTML display page, for the HTML select, the server-side control DropDownList, sometimes need to vary depending on the situation, for some option items, set different colors and different background color, to show the difference, for the HTML control Select, is easy, As long as you specify a style, for server-side controls, because you cannot specify a style or CSS directly, you need to add it yourself with Attributes.
First, the HTML SELECT
<select size= "5" > <option style= "color:white;" >> Black Background white word </option> <option style= "color:red" > Red word </option> <option style= "color : Blue > Blue Words </option></select>
Ii. server-side control:dropdownlist and ListBox for ASP.
Listbox1.items[0]. Attributes.Add ("Style", "background-color:red"); LISTBOX1.ITEMS[1]. Attributes.Add ("Style", "Color:blue"); LISTBOX1.ITEMS[2]. Attributes.Add ("Style", "Color:green");
Triangle Cat Deltacat
Source: Really interesting net (http://www.zu14.cn)
This article is copyrighted by the author, welcome reprint, but without the consent of the author must retain the copyright notice, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.
ASP. NET ListBox DropdownList different entries set the background color and font color (go · Contained