【发布时间】:2011-12-29 22:17:13
【问题描述】:
我可以将一个 Int 数组从 Ajax.ActionLink(来自我的视图)作为参数传递给 Controller
这是我的看法
@{
int [] IDArray = ViewBag.AllIds;
}
@Ajax.ActionLink("send", "SendtoSS", new { id= IDArray }, new AjaxOptions
{
OnBegin = "Routing",
UpdateTargetId = "dialog-model",
InsertionMode = InsertionMode.Replace
}, new { @class = "button" })
在我的控制器中
public ActionResult SendtoSS(int[] ID)
{
}
【问题讨论】:
-
IDArray 在哪里定义?你知道你有一个右方括号但没有左方括号吗?
-
我在视图中有我的数组,请查看我修改的问题的更多详细信息。当我尝试这个时,控制器中的 ActionResult 函数收到空值。但是当我在视图中插入断点并检查 Ajax 链接是否具有 IDArray 值
-
更多细节:关于我的动作,就像这样呈现localhost:80/SendtoSS?ID=System.Int32%5B%5D
标签: asp.net-mvc named-parameters