我正在尝试将 int[] 数组添加到我的 Url.Action 中,如下所示:
var routeData = new RouteValueDictionary();
for (int i = 0; i < Model.GroupsId.Length; i++) {
routeData.Add("GroupsId[" + i + "]", Model.GroupsId[i]);
}
在我看来:
Url.Action("Index", routeData)
但在html中我得到:
GroupsId%5B0%5D=1213&GroupsId%5B0%5D=1214
并不是:
GroupsId=1213&GroupsId=1214
我需要它,因为我有一个复选框列表,当我发布时,我将 groupIds 绑定到 int[],然后通过对我来说不起作用的 Url.Action 来查看我有导出按钮的位置。