我正在开发一个动态的Telerik Tab Strip。
每个标签都有一个网格,我需要将参数传递给操作以过滤我的模型,但该参数总是为空。
查看:
@{ Html.Telerik().TabStrip()
.Name("TabStripDetailArticle")
.Items(tabstrip =>
{
//Know how Many Zones are there
var zones = Model.Articles.GroupBy(e => e.Zone);
//For each Zone I need a Tab,
foreach (var inZone in zones)
{
tabstrip.Add()
.Text(inZone.Key)
.Content(() =>
{
//On each tab there's a Grid and I need to pass the zone to filter my model.
@Html.Action("TabStripSelected", Controllers.Valoration, new { idZone = inZone.Key });
});
}
}
)
.SelectedIndex(0)
.Render();
}
控制器:
public ActionResult TabStripSelected(string idZone)
{
return PartialView("_GridArticlesByZone",CurrentHvm.Articles.Where(e => e.Zone == idZone));
}
我想知道是否是另一种方法,或者我是否遗漏了某些东西。
感谢的!
答案 0 :(得分:0)
我发现了问题! :)
控制器:
foreach (var inZone in zones)
{
//!! Missing!
**IGrouping<string, Article> zone = inZone;**
tabstrip.Add()
.Text(inZone.Key)
.Content(() =>
{
@Html.Action("TabStripSelected", Controllers.Valoration, new { id = **zone.Key** });
});
}
感谢的!