ASP.NEt MVC 3.0 将 Int 数组作为参数从 Ajax ActionLink 传递到控制器
我可以将 Int 数组从 Ajax.ActionLink (从我的视图)传递到控制器作为参数,
这是我的视图
@{
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)
{
}
can i pass an Int Array from Ajax.ActionLink (from my View) to Controller as a parameter
this is my view
@{
int [] IDArray = ViewBag.AllIds;
}
@Ajax.ActionLink("send", "SendtoSS", new { id= IDArray }, new AjaxOptions
{
OnBegin = "Routing",
UpdateTargetId = "dialog-model",
InsertionMode = InsertionMode.Replace
}, new { @class = "button" })
In my Controller
public ActionResult SendtoSS(int[] ID)
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为我无法找到传递数组的解决方案。
我所做的是,在我看来,我已将 ID 数组转换为每个 ID 带有逗号的字符串,并且在我的控制器中,我接收字符串参数并转换回数组。
这暂时解决了我的问题。
但我想知道我们是否可以通过操作链接传递数组作为参数
Since I was not able to find a solution to pass an array.
what i did was, in my view i have converted my Array of IDs to a String with a coma for each ID and in my controller i receive string parameter and convert back to array.
this has solved my problem for now.
But i would like to know if we can pass an array as a parameter through action link