Bind to sitemap

2 posts, 0 answers
  1. Joe
    Joe avatar
    34 posts
    Member since:
    Jul 2012

    Posted 12 Jul 2012 Link to this post

    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!


  2. Joe
    Joe avatar
    34 posts
    Member since:
    Jul 2012

    Posted 12 Jul 2012 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top