I'm using an asp.net Menu (asp:Menu - the built-in one) and I want to assign an image to each MenuItem at design time, but the menu never changes. How do I do that?
+4
A:
The menu items have an ImageUrl property that you can set to the URL of the image:
<asp:Menu ID="Menu1" runat="server">
<Items>
<asp:MenuItem ImageUrl="~/images/image.gif" Text="Menu Item AAA" />
...
You can set this in the markup code (as shown above) or in the designer, by right-clicking the menu and selecting "Edit Menu Items..."
M4N
2009-07-14 21:33:36
ImageUrl docs: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitem.imageurl.aspx
Greg
2009-07-14 21:56:05
Thanks Greg. Added the link to the answer.
M4N
2009-07-14 22:09:41
Thanks, I tried using that property as it made sense to me, but image isnt showing up:[code]<asp:Menu ID="Menu1" runat="server" Height="30px" Orientation="Horizontal" CssClass="MenuItem" BackColor="#ECE9D8" ForeColor="#333333"> <Items> <asp:MenuItem NavigateUrl="~/Administration/Default.aspx" Text="Forside" Value="Forside" ImageUrl="~/Administration/Gfx/house.png"> </asp:MenuItem>[/code]Could there be anything im missing?
H4mm3rHead
2009-07-15 07:53:29
UPDATE: Made a new menu from scratch, image showing up ???? what is blocking the image in my existing code? Any know of anything that could do this?
H4mm3rHead
2009-07-15 08:00:04