hi friend i want to pass multi selected value view to controller but my view pass only single selection my code is here public ActionResult Index() {
var location = new[]{
"select","Hyderabad","Tirupati","Vijayawada","Vishakapatnam","Itanagar","Dispur",
"Guwahati","Raipur","Goa","Ahmedabad","Bharuch",
"Godhra","Jamnagar","Kheda","Rajkot","Surat","Vadodara","Faridabad","Gurgaon","Shimla","Dra
ss","Hiranagar","Poonch","Dhanbad","Ranchi","Bangalore","Hassan","Hubli","Karwar","Mangalore","Mysore","Udupi","Alappuzha","Kannur",
"Kochi","Kollam","Kottayam","Kozhikode","Palakkad","Pathanamthitta","Thiruvananthapuram","Thrissur","Bhopal","Indore","Aurangabad",
"Mumbai","Nagpur","Nasik","Pune","Thane",
"Imphal","Shillong","Aizawl","Kohima","Bhubaneswar","Rourkela","Amritsar","Chandigarh","Jalandhar","Ludhiana","Jaipur","Jodhpur","Udaipur","Gangtok","Chennai","Coimbatore","Karur","Madurai","Thirunelveli","Trichi","Agartala","Delhi" ,"Pondicherry","Allahabad","Lucknow","Varanasi","Kanpur","Durgapur","Kharagpur","Kolkata"
};
var Location = from d in location orderby d ascending select d;
ViewData["Location"] = new MultiSelectList(Location);
view form code
<% using(Html.BeginForm("candidatesearch","Process",FormMethod.Post)){ %>
<%:Html.ListBox("location", ViewData["Location"] as MultiSelectList)%><br />
<input id="location" type="submit" value ="Search"/>
another action method is
public ActionResult candidatesearch(string location )
{
string rg = "";
string[] candidatelocation = location.Split(',');
for (int i = 0; i <= candidatelocation.Length;i++ )
{
rg=rg+candidatelocation[i];
}
Response.Write(rg);
}
but this controller get only single value i can select multiple value