How to highlight an item in a DropDownList in dropdownlist highlight item
The following c# example code demonstrate us how can we highlight DropDownList item or items based on a or many criteria. We can highlight multiple items from DropDownList at run time by conditions.

To highlight items from DropDownList server control, first we loop through the items collection. Then we check each items which text contains 'Goose' characters. If we found an item which 'Text' property value contains 'Goose' then we add a CSS style to this ListItem object. we simply add CSS 'background-color' and 'color' property with value to the specified ListItem object.

In this way we check all items from DropDownList and apply the CSS style to those ListItem object which fulfill the criteria. Finally, DropDownList render in web browser when some of its items are highlighted by different background and text color.

<%@ Page Language="C#" AutoEventWireup="true"%>  
<!DOCTYPE html>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
            string[] birds = { 
                                 "Black Swan",
                                 "Mute Swan",
                                 "Cackling Goose",
                                 "Whooper Swan",
                                 "Tundra Swan",
                                 "Hawaiian Goose",
                                 "Blue Duck",
                                 "Common Shelduck"

            DropDownList1.DataSource = birds;
        foreach (ListItem li in DropDownList1.Items)
            if (li.Text.Contains("Goose"))
                li.Attributes.Add("style", "background-color:crimson;color:white");
<html xmlns="">      
<head id="Head1" runat="server">      
    <title> dropdownlist highlight item</title>
    <form id="form1" runat="server">      
        <h2 style="color:MidnightBlue; font-style:italic;">      
   example - dropdownlist highlight item
        <hr width="550" align="left" color="Gainsboro" />      
        <br /><br />
More examples