Sitemap Binding

To bind a Kendo UI Menu to a sitemap:

  1. Make sure you followed all the steps from the introductory article on Telerik UI for ASP.NET Core.

  2. Create a simple sitemap with the sample.sitemap file name at the root of the project.

    <?xml version="1.0" encoding="utf-8" ?>
        <siteMapNode title="Home" controller="Home" action="Overview">
        <siteMapNode title="Grid">
            <siteMapNode controller="grid" action="index" title="First Look (Razor)" area="razor"/>
        <siteMapNode title="Menu">
            <siteMapNode controller="menu" action="index" title="First Look (Razor)" area="razor"/>
  3. Load the sitemap using SiteMapManager.

    public ActionResult Index()
        if (!SiteMapManager.SiteMaps.ContainsKey("sample"))
            SiteMapManager.SiteMaps.Register<XmlSiteMap>("sample", sitmap => sitmap.LoadFrom("~/sample.sitemap"));
        return View();
  4. Add a Menu.

        .Name("menu") //The name of the Menu is mandatory. It specifies the "id" attribute of the widget.
        .BindTo("sample") //Bind to the sitemap with name "sample".

See Also

In this article
Not finding the help you need? Improve this article