Can we get multiple values from select tag via Ajax script in asp.net MVC controller?
1 answer
Yes, you can create a multi-selection like this:
<select multiple="multiple" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
And your controller action should look something like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(string[] cars)
{
// ....
return View();
}
The ajax post codecan will be the same as in your previous case.
0
a source to share