Images in dropdown list

2020-01-25 01: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

8条回答
一纸荒年 Trace。
2楼-- · 2020-01-25 01:17

With standart dropdownlist, you can not achive this.

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

查看更多
Emotional °昔
4楼-- · 2020-01-25 01:23

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

查看更多
forever°为你锁心
5楼-- · 2020-01-25 01:24

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

查看更多
家丑人穷心不美
6楼-- · 2020-01-25 01:36

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>
查看更多
干净又极端
7楼-- · 2020-01-25 01:36

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.

查看更多
登录 后发表回答