下拉列表高亮显示

本文关键字:显示 高亮 下拉列表 | 更新日期: 2023-09-27 18:26:16

我有一个下拉列表,其中包含以下列表项,

<asp:DropDownList ID="ddlsendmail" runat="server" Width="250px" AutoPostBack="true"
    OnSelectedIndexChanged="ddlsendmail_SelectedIndexChanged" onchange="test();">
    <asp:ListItem>--select--</asp:ListItem>
    <asp:ListItem Value="Members">Members</asp:ListItem>
    <asp:ListItem Value="NonMembers">Non-Members</asp:ListItem>
    <asp:ListItem Value="Location">Location</asp:ListItem>
</asp:DropDownList>

当我选择"位置"时,另一个下拉列表与金奈(100)、孟买(156)、班加罗尔(132)等值绑定,

<tr id="tdsendmaillocation" runat="server" visible="false">
    <td>
        Location:
    </td>
    <td>
        <asp:DropDownList ID="ddlsendmaillocatiom" runat="server" Width="250px">
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" SetFocusOnError="true" ValidationGroup="group"
            ControlToValidate="ddlsendmaillocatiom" InitialValue="0" runat="server" Display="Dynamic"><img src="images/error.png" title="Required Field" border="0" /></asp:RequiredFieldValidator>
    </td>
</tr>

现在我只想从上面列出的项目中突出(100)、(156)、(132)。。红色。。。。。。

下拉列表高亮显示

通常情况下,您不能这样做。您不能像往常一样对选择框中的选项进行样式设置。有一些替换插件看起来像SELECT,但实际上是由标准HTML元素组成的,这些元素的样式可以像div元素。