Kendo ui 筛选子剑道菜单asp mvc
我有一个小问题,我不知道如何解决,我想过滤我菜单的子菜单或只返回子菜单的一个值,我的控制器中有:Kendo ui 筛选子剑道菜单asp mvc,kendo-ui,kendo-asp.net-mvc,Kendo Ui,Kendo Asp.net Mvc,我有一个小问题,我不知道如何解决,我想过滤我菜单的子菜单或只返回子菜单的一个值,我的控制器中有: public ActionResult ModelBinding() { NorthwindDataContext northwind = new NorthwindDataContext(); var data = (from m in northwind.Categories join a in northwind
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;
}));
})
)
@model IEnumerable
@(Html.Kendo().Menu())
.名称(“菜单”)
.BindTo(模型,映射=>
{
mappings.For(binding=>binding
.ItemDataBound((项目,类别)=>
{
item.Text=category.CategoryName;
})
.儿童(类别=>类别.产品));
mappings.For(binding=>binding
.ItemDataBound((项目、产品)=>
{
item.Text=product.ProductName;
}));
})
)
在我的控制器中,我发送ProductID==1的过滤器,但是当菜单运行这个时,类别将返回该类别的所有产品,有时类似这样
- Beberages
- 柴 张
- 瓜拉那幻想曲
- 沙司夸克啤酒
我想只给我一个产品,所以我怎么做,或者把过滤器放在哪里,有人举个例子我真的很感谢你的帮助,谢谢你可以看看我的答案。在那个页面中,我显示了剑道组合框上的过滤。希望这有帮助……请检查我下面的答案,并告知它是否有效。。。