Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6084499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:31:44+00:00 2026-05-23T11:31:44+00:00

hi friend i want to pass multi selected value view to controller but my

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:31:45+00:00Added an answer on May 23, 2026 at 11:31 am

    Change

    public ActionResult candidatesearch(string location )
    

    To

    public ActionResult candidatesearch(string[] location )
    

    Each item in the list should be an index in the array. Instead of your split you can then do:

    foreach(var item in location)
    {
        //do something with item
    }
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flex code that i got from a friend. But i want
I'm working on a project with a friend and I want to return to
I want that everyone can send a message to a friend after the user
I need to write a forum application for a friend's web site. I want
Hi friends I want to make the squares in a row but I could
I want to know how I can pass a variable from one page to
I have used Facebook invite friend application,I want to customize the Facebook buttons and
I want to make a class A friend class of class B. I want
I want to Sign a application that my friend sent me for signing. The
I want to pass data from form1 to form2 and i used The Properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.