Hiding empty menu items

2 posts, 0 answers
  1. Assaf
    Assaf avatar
    3 posts
    Member since:
    Jul 2010

    Posted 19 Oct 2012 Link to this post


    I'm using the Kendo.Mvc.Menu with a site map and security trimming.
    My problem is that when all sub items of a menu item are trimmed, the parent item is still being displayed.

    I've found an answer to a similar question regarding the Telerik.Menu, on this thread.
    However, I could not find the equivalent in the Kendo framework to this line:

    <% var navAuthorization = Telerik.Web.Mvc.Infrastructure.ServiceLocator.Current.Resolve<Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>(); %>

    Best regards,

  2. Lauri
    Lauri avatar
    2 posts
    Member since:
    Jul 2008

    Posted 16 May 2013 Link to this post


    This might come a bit late, but for others searching for the same thing:
    @{var navAuthorization = Kendo.Mvc.Infrastructure.DI.Current.Resolve<Kendo.Mvc.Infrastructure.INavigationItemAuthorization>(); }
    and the menu part
    @Html.Kendo().Menu().Name("Menu").BindTo("sitemap", (item, siteMapNode) =>
    var hasAccessible = true;
     foreach (var children in siteMapNode.ChildNodes)
     hasAccessible = false;
     if (children.IsAccessible(navAuthorization, ViewContext))
     hasAccessible = true;
     item.Visible = hasAccessible;
Back to Top