13

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

Adriano Carneiro
  • 55,739
  • 12
  • 86
  • 122
Nagu
  • 4,764
  • 13
  • 47
  • 66

8 Answers8

19

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>
Glorfindel
  • 20,880
  • 13
  • 75
  • 99
Seb Nilsson
  • 25,650
  • 29
  • 100
  • 128
2

Dropdownlist with images

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

Sumit
  • 21
  • 1
2

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

kapa
  • 75,446
  • 20
  • 155
  • 173
Atta Ur Rahman
  • 141
  • 2
  • 4
1

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.

kapa
  • 75,446
  • 20
  • 155
  • 173
hadi teo
  • 946
  • 6
  • 11
0

With standart dropdownlist, you can not achive this.

You need to write a custom server control that is not based on dropdown list.

Canavar
  • 47,036
  • 17
  • 87
  • 121
0

You cannot achieve this with a raw drop down list / combo box in C#. The underlying control only supports text and not a combination of text + image.

You'll either need to write a custom control or use something like jQuery to build the drop down with your code populating the results.

JaredPar
  • 703,665
  • 143
  • 1,211
  • 1,438
0

i found this. and this is working for me.

http://www.aspdotnet-pools.com/2014/09/dropdownlist-item-with-custom-icon.htmlenter link description here

Mahmut EFE
  • 4,971
  • 5
  • 42
  • 55
0

That's right, standard tool doesn't accept images, try with a custom tool.

try with this free tool: http://controlsbuilder.com/tools/CustomDropDownList.aspx

kapa
  • 75,446
  • 20
  • 155
  • 173