Images in Dropdown list

asp India
  • 14 years ago

    Hi Friends,

    How add images to a dropdownlist using ASP. 

    Awaiting for your favarable reply......

    Thanks and Regards,

    Smiley Face [:)] SudhaThangaraj


  • 14 years ago

    simply with styles man ...



    select id="Select1" style="width: 270px">

    <option selected="selected" value="1" style="background-image: url(myWebsite/images/first01.gif);">opt01</option>

    <option value="2">opt02</option>

    <option value="3">opt03</option>





  • 14 years ago

    This is not working out.....

    Any way thanks.....

    Smiley Face [:)] Sudha

  • 14 years ago

    Sorry .
    the "select" tag is one of the few tags on which the background-image style does not work ..

    I've found this .. may be you can try ?





  • 12 years ago

     <head runat="server">
         <style type="text/css">
        .test1{background-repeat:no-repeat; background-position:right; background-image: url(images/AmEx.gif); vertical-align:middle; margin-top:4px; margin-bottom :4px; margin-right :8px;}
        .test2{background-repeat:no-repeat; background-position:right; background-image: url(images/Visa.gif); vertical-align:middle; margin-top:4px; margin-bottom :4px; margin-right :8px;}
        <form id="form1" runat="server">
                <asp:DropDownList ID="cmbCardType" runat="server" CssClass="cmbCardTypeAnonims" Width ="200px">
                    <asp:ListItem Text="Visa" Value="VIS" class="test1"></asp:ListItem>
                    <asp:ListItem Text="Visa" Value="VIS" class="test2"></asp:ListItem>


    try it, it works...........

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup