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

Bind to sitemap

1 Answer 333 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 12 Jul 2012, 04:16 PM
I am having problems implementing the site map binding. I have scoured your example and don't understand how yours is working and mine isn't. Here is the code:
@(Html.Kendo().Menu()
        .Name( "KendoMenu" )
        .BindTo( "WebSiteMap"))

And in my Home Controller index method:
if( !SiteMapManager.SiteMaps.ContainsKey( "WebSiteMap" ) )
{
    SiteMapManager.SiteMaps.Register<XmlSiteMap>( "WebSiteMap", sitemap => sitemap.LoadFrom( "~/Web.sitemap" ) );
}

However I still get this error:

"You must have a SiteMap defined with key "WebSiteMap" in ViewData dictionary." I'm pretty sure that is what my code is doing so I don't understand why I would be getting this error.

Any thoughts?

Thanks!


1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
answered on 12 Jul 2012, 07:14 PM
Okay so this was in a mixed project with regular Telerik MVC stuff as well as the Kendo UI MVC Wrapper stuff. The sitemapmanager was being pulled from the telerik reference, not the kendo reference. I just had to update my using statement to use the kendo namespace and now it workd. Doh!
Tags
Menu
Asked by
Joe
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 1
Share this question
or