ASP.NET 2.0, setting the ImageUrl value, how???

J

Jeff

Hey

ASP.NET 2.0

I'm working on a website which I want the menu control to have images to
left for the text in the menuitem... So far I've read that this can be done
by providing the ImageUrl for the menuitem with a URL to the specific image.

The problem is that I don't know how to set this ImageUrl value for every
menuitem. I'm using a .sitemap where all the menuitems are specified. And
also I want this property in ImageUrl to be defined by Theme - My website
comes with different themes, the user can select the theme he wants. Then it
could be cool if the image in ImageUrl could vary depending on selected
Theme!

Any suggestions?

Below is example content of my .sitemap file and the menu markup

Menu markup:
<asp:Menu ID="MyMenu"
runat="server"
DataSourceID="smdsMyMenu"
MaximumDynamicDisplayLevels="2"
Orientation="Vertical"
StaticDisplayLevels="2"
StaticMenuItemStyle-CssClass="menuitem"
OnMenuItemDataBound="mnuSidebar_MenuItemDataBound" >

<levelmenuitemstyles>
<asp:menuitemstyle CssClass="MenuHeadline"/>
<asp:menuitemstyle BackColor="White" forecolor="Blue"/>
</levelmenuitemstyles>

</asp:Menu>
<asp:SiteMapDataSource ID="smdsMyMenu"
runat="server"
SiteMapProvider="MyMenu"
ShowStartingNode="false"
StartingNodeOffset="0" />

Sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="#" title="My Menu" description="">
<siteMapNode url="1" title="sub item 1" description="">
<siteMapNode url="2" title="sub item 2" description="" />
<siteMapNode url="3" title="sub item 3" description="" />
<siteMapNode url="4" title="sub item 4" description="" />
<siteMapNode url="5" title="sub item 5" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,056
Messages
2,570,441
Members
47,118
Latest member
nocode69

Latest Threads

Top