Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in dropdown list

Hi I want to put image along with some data in asp.net drop down list box.

Can somebody give me a sample code to achieve this functionality?

country flag + country name --> in the same list item

like image 294
Nagu Avatar asked Jul 03 '09 12:07

Nagu


People also ask

How do I put an image in a drop down menu?

Add <img> tag in dropdown content to insert image into dropdown list for each items. Note: In case the user needs the width of the content to be as wide as the dropdown button, please set the width to 100% (Set overflow: auto to get scroll on small screens).

Can I put image in select option?

We can add an image in select options using "select2" jQuery library.

How do I create a dropdown image in HTML?

HTML) Use any element to open the dropdown content, e.g. a <span>, or a <button> element. Use a container element (like <div>) to create the dropdown content and add whatever you want inside of it. Wrap a <div> element around the elements to position the dropdown content correctly with CSS.


4 Answers

You could use jQuery Image Dropdown:

http://marghoobsuleman.com/jquery-image-dropdown

jQuery Image Dropdown
(source: marghoobsuleman.com)

<script language="javascript">    
$(document).ready(function(e) {
    try {
        // target some ids
        MSDropDown.init("#combo1, #combo2");
        //by wild card
        MSDropDown.init("#divid select");
        //or 
        MSDropDown.init("#formid select");
    } catch(e) {
    alert(e);
    }
})
</script>
like image 78
Seb Nilsson Avatar answered Oct 18 '22 23:10

Seb Nilsson


Dropdownlist with images

http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=90

like image 20
Sumit Avatar answered Oct 19 '22 01:10

Sumit


Try this, it's one of the best solution.... and easiest
http://www.obout.com/combobox/icons/aspnet_icons_database.aspx

like image 2
Atta Ur Rahman Avatar answered Oct 19 '22 00:10

Atta Ur Rahman


I haven't tried to use this JQuery Combo-Box, but from the screenshot, it looks like the items in the combo box can include an image in it. Maybe you could research more regarding this.

like image 1
hadi teo Avatar answered Oct 19 '22 00:10

hadi teo