I was wondering is there a way to list image and label using @Html.DropDownListFor helper in MVC razor? Something like this:
(source: dotnetspeaks.com)
There's nothing like this built into MVC, but I'm sure there are many 3rd-party components. I personally use dijit for this kind of thing, but since you have JQuery as one of your tags, you could probably use the Menu from JQuery UI.
DropDownListFor
renders a <select>
. This HTML element does not support an image in the list. you will need to use a JavaScript library to get this effect. several of the libraries use a <select>
as the basis (they hide the select but get values form it.) there are dozens of select replacement libraries.
Have a look at this tutorial, this will help you creating drop down list with images.
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