ASP.NET - hi - Asked By saran vasan on 09-Feb-12 05:04 AM

how to use images in menus in asp.net
Web Star replied to saran vasan on 09-Feb-12 05:18 AM

you can use image in menu control simply you can add image url with menu item as follows

<asp:Menu ID="OnePageTab" runat="server" Orientation="Horizontal" BackColor="#E3EAEB" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#666666" StaticSubMenuIndent="10px" >
<Items>
<asp:MenuItem ImageUrl="Images/editirc.png" NavigateUrl="~/OnePageHome.aspx"
Text=" " ></asp:MenuItem>
<asp:MenuItem ImageUrl="Images/ADDIRC.png" NavigateUrl="~/AddIRC.aspx"
Text=" " ></asp:MenuItem>

</Items>
</asp:Menu>
saran vasan replied to Web Star on 09-Feb-12 05:44 AM
thanks a lot
smr replied to saran vasan on 09-Feb-12 05:51 AM
hi

you can apply css for this

Exmaple:

<style type="text/css">
.menuItem
{
color:black;
border:Solid 1px Gray;
background-color:#c9c9c9;
background-image : url(ur Gif Image url);
padding:2px 5px;
}
</style>


add this Cssclass below
:

<asp:Menu
id="Menu1"
Orientation="Horizontal"
StaticMenuItemStyle-CssClass="menuItem"
DynamicMenuItemStyle-CssClass="menuItem"
Runat="server">
 
<Items>
<asp:MenuItem Text="Item1">
<asp:MenuItem Text="Item2" />
<asp:MenuItem Text="Item3" />
</asp:MenuItem>
<asp:MenuItem Text="Item4">
<asp:MenuItem Text="Item5">
<asp:MenuItem Text="Item6" />
<asp:MenuItem Text="Item7" />
</asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>

follow
http://forums.asp.net/t/1056497.aspx/1
Somesh Yadav replied to saran vasan on 09-Feb-12 06:00 AM

The menu items have an http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitem.imageurl.aspx 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..."

Web Star replied to saran vasan on 10-Feb-12 04:49 AM
you welcome!