Solved

Add an image next to asp:menuitem at runtime

Posted on 2009-04-02
2
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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