This is a migrated thread and some comments may be shown as answers.

Binding to Sitemap issue using "mvc" sitemap format per your example code

1 Answer 110 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ed
Top achievements
Rank 1
Ed asked on 23 Nov 2011, 03:31 AM
I'm trying to bind a menu to a siteprovider just like in your provided example. The problem I'm having is I can't get it to work with the format of sitemap file you use in the example. I can only get it to work with the old net forms sitemap format. I just swap out my sitemap file for the one in your example and it breaks the menu. I get some rendering, but the links do not work, and the levels don't work and the urls are not being generated. If I simply swap back my sitemap file it all works fine. I thought maybe you were using the MvcSiteMapProvider, but see no reference to it in your example. What am I missing? Are you doing something in your example that I'm missing that lets you use the "mvc" friendly sitemap format?

Thank you!


My code:

global.asax.cs

            SiteMapManager.SiteMaps.Register<XmlSiteMap>("Web", sitmap => sitmap.Load());

View:

  @(Html.Telerik().Menu()
       .Name("Menu")
       .BindTo("Web")

don't need a controller action as it is being registered in the global file.

This format breaks the menu:
  <siteMapNode controller="grid" action="FirstLook" title="First Look" />

The format that works:
  <siteMapNode url="/photos" title="Event photos"  description="" />

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 28 Nov 2011, 10:55 AM
Hello Ed,

 
I am not sure where could be problem. The code looks OK. Check the attached test project, which I have made in order to replicate the issue, but to no avail.

Telerik Extensions for ASP.NET MVC implement own SiteMap provider. We do not provide build-in support for MvcSiteMapProvider. Nevertheless you can easily bind the menu using this online demo as a reference.

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Menu
Asked by
Ed
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or