C# – Images in dropdown list

asp.netc++drop-down-menu

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

Best Solution

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>