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

  • Home
  • SEARCH
  • 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 8849847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:45:37+00:00 2026-06-14T12:45:37+00:00

I am using asp.net mvc3. I want to pass an array from view to

  • 0

I am using asp.net mvc3. I want to pass an array from view to the controller using parameterMap as shown below. In my view:

     parameterMap:
            function (data, options) {
               if (options === "read") {
               sessionStorage.setItem("value","array");
               val = sessionStorage.getItem("value"); // contains array
               return { model: JSON.stringify(val) }; //passing array to controller
                }
            }

In controller:

  public ActionResult SearchDetails( string model)     
  {
     var query = (from ......).where();//want to compare array values in controller
        
  }

but I am not able to retrieve those values in the controller. How can I retrieve these array of values in my controller without using looping statements?

My array contains only integer values (ids), while debugging the when I put cursor at the parameter of action method the values are coming in ""[{\"id\":1},{\"id\":2}]"" format. How can I use this array of values in my WHERE clause of my query?

  • 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-06-14T12:45:38+00:00Added an answer on June 14, 2026 at 12:45 pm

    if you are bound and determined to stick with the string input, I would think a call to Split would work. However, it would be much easier if you changed from bringing it in as a string to just bringing in the model. Have you tried something like:

      public ActionResult SearchDetails( model model)     
      {
         var query = (from ......).where();//want to compare array values in controller
    
      }
    

    are you trying to do something equivalent to a SQL IN? If that is the case then use .Contains in your query. For example:

    public ActionResult SearchDetails(model model)
    {
        var query = from d in context.data
                    where model.Contains(d.id)
                    select d;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pass two values from controller action to asp.net MVC 3 Razor
Using ASP.net MVC3 with C# I want to create a partial view that uses
In ASP.NET MVC3, when a view model is passed into a view using return
Possible Duplicate: ASP.NET MVC3 how to excute action method of controller using timer with
I'm using ASP.NET MVC3 with razor engine.I want to apply css class on body
i'm using asp.net mvc3 with jquery datepicker widget. i want the user to click
I have a website developed using ASP.NET MVC3. I now want to expose a
I'm using asp.net mvc3. Our app heavily uses the HttpRuntime.Cache to store data in
I'm using asp.net MVC3 and i want to show a table containing information about
I have an href in my asp.net MVC3 Razor view and I want to

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.