• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

Add an image next to asp:menuitem at runtime

Hi Guys,

I have a menu control on ASPX page and I am adding menuitems to this control during runtime.

My requirement is to display an image next to menuitem, if some condition is true, otherwise render menuitem without any image next to it.

I have tried with setting "ImageUrl"  property of a menuitem, but it doesn't worked.

I appreciate if anyone let me know the answer.

Kiran G

1 Solution
ImageUrl works in this case. I tried it with the code attached.
Please post an example if there are any problems.

MenuItem item;
item = new MenuItem("Item Without Image", "ItemWithoutImage");
item = new MenuItem("Item With Image", "ItemWithImage", "~/images/red.jpg");

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now