ASP. NET ListBox DropdownList different entries set the background color and font color (go · Contained

Source: Internet
Author: User
Tags set background

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.