【问题标题】:filter children kendo menu asp mvc过滤儿童剑道菜单asp mvc
【发布时间】:2013-04-24 22:03:12
【问题描述】:

我有一个小问题,我不知道如何解决,我想过滤我的菜单的子菜单或只返回子菜单的一个值,我的控制器中有这个:

 public ActionResult ModelBinding()
    {
        NorthwindDataContext northwind = new NorthwindDataContext();
        var data = (from m in northwind.Categories
                    join a in northwind.Products on m.CategoryID equals a.CategoryID
                    where m.CategoryID == 1 && a.ProductID == 1 
                    select m).ToList();
        return View(data);
    }

这是我的观点

 @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;
                    }));
      })
)

在我的控制器中,我将过滤器发送到 ProductID == 1 但是当菜单运行这个时,该类别返回我该类别的所有产品,有时像这样

  • 啤酒
    • Chai
    • Chang
    • Guarana Fantastica
    • Sasquach Ale

我希望只给我一个产品,所以我该怎么做或者我可以在哪里放置过滤器,有人有一个例子我真的很感激帮助,谢谢

【问题讨论】:

  • 请在下面查看我的答案并告知它是否有效...

标签: kendo-ui kendo-asp.net-mvc


【解决方案1】:

你可以看看我在Multiple filters in Kendo Combobox 上的回答。在那个页面中,我展示了 Kendo Combobox 上的过滤。希望这会有所帮助...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-06
    • 2020-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-19
    相关资源
    最近更新 更多