genxgeek
genxgeek

Reputation: 13367

How to get jQuery multiselect values on the server side?

I'm using the following jquery multiselect plugin ... How can I grab the selected values server side via asp.net mvc3 within the [HttpPost] ActionResult()?

Upvotes: 0

Views: 1965

Answers (2)

Xavier Poinas
Xavier Poinas

Reputation: 19743

You can just have an array as a parameter of your controller method:

[HttpPost]
public ActionResult ActionName(string[] nameOfMultiSelect)
{
    ....
}

Upvotes: 1

Michael Grassman
Michael Grassman

Reputation: 1935

Request["FormElementName"]

Will come through as a comma separated list.

Or if it's in your model you can acccess it via model.FormElementName which would come through as a array of strings or integers depending on your datatype.

Upvotes: 1

Related Questions