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
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).
We can add an image in select options using "select2" jQuery library.
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.
You could use jQuery Image Dropdown:
http://marghoobsuleman.com/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>
Dropdownlist with images
http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=90
Try this, it's one of the best solution.... and easiest
http://www.obout.com/combobox/icons/aspnet_icons_database.aspx
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With