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 8322873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:31:52+00:00 2026-06-08T23:31:52+00:00

I am using Multiselect feature to select multiple rows and pass to the controller.

  • 0

I am using Multiselect feature to select multiple rows and pass to the controller. The javascript is below:

onClickButton: function (ids) {

var grid = $("#employee");
var rowid = grid.jqGrid('getGridParam', 'selarrrow');

var count = rowid.length;
var rowData;
var colData = [];

for (var i = 0; i < count; i++) {
   rowData = $("#employee").getRowData(rowid[i]);
   colData[i] = rowData.ID;
                            }

$.ajax({
    type: 'POST',
    url: '/Home/Create/' + colData,
   //data: { id: colData },
    dataType: "json"
    });
}

My controller action is below:

public ActionResult Create(string id){
JavaScriptSerializer ser = new JavaScriptSerializer();
var myList = ser.Deserialize<List<string>>(id);}

I am creating colData as an array and currently adding four IDs to it (“102,103,104,105”). When I debug and look at the colData, it contains “102,103,104,105”. Then, I pass it to the controller action as a string and then deserialize it. When I deserialize it, it complains as “Invalid JSON primitive: 103,104,105.”

I have seen other posts but couldn’t find anything related to my issue. When I pass colData using “data: { id: colData }”, id is returned as null.

Please help me figure out this issue, it’s been a while I am stuck with this one. Any suggestions greatly appreciated.

  • 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-08T23:31:54+00:00Added an answer on June 8, 2026 at 11:31 pm

    when you are sending your data through ajax call you need to stringyfy your data like this

    $.ajax({
            type: 'POST',
            url: '@Url.Action("AddMe")',
            contentType: 'application/json; charset=utf-8',
            data:JSON.stringify({Id: colData}),
            dataType: "json",
    success:function(){
           //do sth here
             }
    
             error: function () {
    //do sth here
            }
    
            }); 
    

    I hope this helps.

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

Sidebar

Related Questions

I am using a multiselect with options grouped together. <select title=Fruits multiple=multiple id=fruits name=fruits[]>
I'd like to implement a multiselect function using jqGridRender (the php only version of
I have a listbox with multiselect options. I populate it using the addItem function.
I'm using the ui-multiselect widget to render a <select> list differently. I'm trying to
I am using Jquery UI like this: $(#companyType).multiselect({ multiple: false, header: Type, noneSelectedText: Type,
I am using the following jQuery multiselect script on the select boxes on my
I am using http://dingyonglaw.github.com/bootstrap-multiselect-dropdown/#forms to display a dropdown with multiple check boxes. <li> <label>
I am using jquery multiselect in my project,when user clicks on checkall then how
I'm trying to create the illusion of a multiselect dropdown using a div that
I am using Eric Hynd's wonderful multiselect plug in to populate a couple of

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.