【发布时间】:2011-09-17 17:26:27
【问题描述】:
我正在尝试将 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 来查看我有导出按钮的位置。
【问题讨论】:
标签: asp.net-mvc-3 binding asp.net-mvc-routing url.action