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>

    <option></option>

    </select>

     

    Serval

  • 14 years ago
    Hi,

    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 ?

     

    http://www.csharpfr.com/codes/LISTBOX-AVANC-201_29583.aspx

     

    Serval

     

  • 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;}
         </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <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>
                </asp:DropDownList>
            </div>
        </form>
    </body>

     

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

Post a reply

Enter your message below

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

Contribute

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