Himadri
Himadri

Reputation: 8876

How to show images in dropdownlist options?

I need to have a dropdownlist whose options contains text followed by a small image.

Suppose I have a dropdownlist of fruits. I want to show the options as :

Option 1 : small Image of mango then text Mango

Option 2 : small Image of orange then text Orange .....................

Is it possible to implement in asp.net 2.0?

If yes then please help with sample code.

I don't want to use JQuery.

Upvotes: 0

Views: 965

Answers (2)

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

You don't need to use JQuery, use CSS background-image property for every <option>.

Upvotes: 0

jaywon
jaywon

Reputation: 8234

You can do that server side by just placing <asp:Image ImageUrl="some.gif" /> tags in your ASP.NET code. The browser will show them when the page is loaded.

Upvotes: 3

Related Questions