This question is locked. New answers and comments are not allowed.
Hi,
I have created Menu using Sitemap.
SITEMAP CODE
<siteMapNode title="MainMenuItem">
<siteMapNode controller="subController1" action="Index" title="SubMenu1"/>
<siteMapNode controller="subController2" action="Index" title="SubMenu2" />
<siteMapNode controller="subController3" action="Index" title="SubMenu3" />
</siteMapNode>
Telerik Code is:
Html.Telerik().Menu().Name("MyMenu").BindTo("web").Orientation(MenuOrientation.Vertical).Render()
how can i add image to MainMenuItem or SubMenuItem of Menu
Thanks,
Lakul
I have created Menu using Sitemap.
SITEMAP CODE
<siteMapNode title="MainMenuItem">
<siteMapNode controller="subController1" action="Index" title="SubMenu1"/>
<siteMapNode controller="subController2" action="Index" title="SubMenu2" />
<siteMapNode controller="subController3" action="Index" title="SubMenu3" />
</siteMapNode>
Telerik Code is:
Html.Telerik().Menu().Name("MyMenu").BindTo("web").Orientation(MenuOrientation.Vertical).Render()
how can i add image to MainMenuItem or SubMenuItem of Menu
Thanks,
Lakul
5 Answers, 1 is accepted
0
Hello Lakul,
In order to achieve your goal you will need to use SiteMapNode.Attributes collection:
[View]:
[Sitemap]:
Regards,
Georgi Krustev
the Telerik team
In order to achieve your goal you will need to use SiteMapNode.Attributes collection:
[View]:
<%= Html.Telerik().Menu()
.Name("Menu")
.BindTo("sample", (item, node) => {
var url = node.Attributes["imageurl"];
if(url != null)
item.ImageUrl = node.Attributes["imageurl"].ToString();
})
%>
[Sitemap]:
<
siteMapNode
title
=
"MainMenuItem"
>
<
siteMapNode
controller
=
"subController1"
action
=
"Index"
title
=
"SubMenu1"
imageurl
=
"imageurl"
/>
<
siteMapNode
controller
=
"subController2"
action
=
"Index"
title
=
"SubMenu2"
/>
<
siteMapNode
controller
=
"subController3"
action
=
"Index"
title
=
"SubMenu3"
/>
</
siteMapNode
>
Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Lakul
Top achievements
Rank 1
answered on 08 Sep 2010, 05:05 PM
Thanks Georgi Krustev
0

Sysdata Labs
Top achievements
Rank 1
answered on 11 Nov 2010, 11:49 PM
Thanks! This is exactly what I was looking for. Works great.
0

steve
Top achievements
Rank 1
answered on 13 Dec 2010, 03:44 PM
I am wondering if I can use sitemapnode attributes to add change the class, id, or border styles. Because the telerik menu automatically sets all of items in my menu to be in the same class, I cannot customize the border for an individual item. If I can change the class on one item, then I could change the css to edit the border. Or, if I can change the border from the site map, that would also work. If anyone knows a solution, please share. Thank you.
0

Sysdata Labs
Top achievements
Rank 1
answered on 16 Apr 2011, 08:54 PM
I was able to fully customize the layout of the Menu controller by setting custom formatting for the exact CSS class the controller renders. I used Google Chrome's developer tools to find the right CSS class name. From Chrome, just click "Ctrl + Shift + I" and hover over the menu controller. Good luck!