Click here to Skip to main content
15,886,780 members
Please Sign up or sign in to vote.
1.89/5 (2 votes)
See more:
I want to do styling of dropdownlist in asp.net .Please provide pointers .
I want to change its background color and hover color .
Any examples are appreciated .
Posted
Comments
Sergey Alexandrovich Kryukov 28-Mar-13 13:40pm    
Why do you think that just reading the documentation is not enough?
—SA

Since all Aspx controls rendered as html controls you can write css as below..
css below..
CSS
<style type="text/css">
        select
        {
            color:#FFFFFF;
            margin:0px 0px 0px 0px !important;
            padding:0px 0px 0px 0px !important;
            width:200px;
        }

        select option
        {
            background:#000;
        }
       
    </style>

Html below..
ASP.NET
<asp:dropdownlist id="ddlTest" runat="server" xmlns:asp="#unknown">
    <asp:listitem value="Item 1">Item 1</asp:listitem>
    <asp:listitem value="Item 2">Item 2</asp:listitem>
 </asp:dropdownlist>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900