Solved

Add an image next to asp:menuitem at runtime

Posted on 2009-04-02
2
234 Views
Last Modified: 2012-05-06
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.

Cheers,
Kiran G

0
Comment
Question by:kirankumar_goura
2 Comments
 
LVL 4

Accepted Solution

by:
mysteriousguy earned 125 total points
ID: 24057517
ImageUrl works in this case. I tried it with the code attached.
Please post an example if there are any problems.

Martin
MenuItem item;

item = new MenuItem("Item Without Image", "ItemWithoutImage");

Menu1.Items.Add(item);

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

Menu1.Items.Add(item);

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now