Solved

Add an image next to asp:menuitem at runtime

Posted on 2009-04-02
2
237 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

12 Experts available now in Live!

Get 1:1 Help Now