HaBo
HaBo

Reputation: 14297

ASP.NEt MVC 3.0 Pass Int Array as Parameter from Ajax ActionLink to Controller

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

Answers (1)

HaBo
HaBo

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

Related Questions