Reputation: 14297
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)
{
}
Upvotes: 1
Views: 985
Reputation: 14297
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
Upvotes: 1