我必须将一个组列表从视图传递给控制器操作。组列表在Viewbag.Group中。我尝试通过url.action发送,但它不起作用,我也不确定我们是否可以这样发送。这是我的代码:
@foreach (var x in ViewBag.Group)
{
var active = Request.QueryString[x] == x ? "list-group-item active" : "list-group-item";
<a class="@active" href=@Url.Action(x, "Search", new { searchText = ViewBag.searchText,grp=ViewBag.Group})>@x</a>
}