Requesting Dynamic Menu Code Example

2 posts, 0 answers
  1. Robert
    Robert avatar
    2 posts
    Member since:
    Aug 2014

    Posted 27 Aug 2014 Link to this post

    Hello,

    Does anyone have a working sample or know of complete documentation that shows how to create a dynamic menu that is built upon hierarchy settings that are retrieved from SQL Server, utilizing C# and MVC?

    Thank You in Advance!

    Robert
  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 29 Aug 2014 Link to this post

    Hello Robert,

    Here they are:

    Documentation:

    http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/menu/overview#bind-kendo-menu-to-a-hierarchical-model

    Demo:

    (for a more in-depth inspection, check the "Model Binding" Menu example in the offline ASP.NET MVC demo site, which is shipped with the UI for ASP.NET MVC package)

    @model IEnumerable<Kendo.Mvc.Examples.Models.Category>
     
    @(Html.Kendo().Menu()
          .Name("Menu")
          .BindTo(Model, mappings =>
          {
                mappings.For<Kendo.Mvc.Examples.Models.Category>(binding => binding
                        .ItemDataBound((item, category) =>
                        {
                            item.Text = category.CategoryName;
                        })
                        .Children(category => category.Products));
                mappings.For<Kendo.Mvc.Examples.Models.Product>(binding => binding
                        .ItemDataBound((item, product) =>
                        {
                            item.Text = product.ProductName;
                        }));
          })
    )


    Regards,
    Dimo
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top