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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:56:55+00:00 2026-06-17T23:56:55+00:00

I am displaying multiple records on my ASP.NET MVC 4 view where each record

  • 0

I am displaying multiple records on my ASP.NET MVC 4 view where each record has a checkbox. I want the user to be able to select multiple records (by checking checkboxes) and click Delete button in order to delete them. So far I can call the Delete Action method via jquery ajax but the problem is my action method does not seem to be accepting the passed array.
Here is my jquery code:

    $(function () {

    $.ajaxSetup({ cache: false });

    $("#btnDelete").click(function () {
        $("#ServicesForm").submit();
    });

    $("#ServicesForm").submit(function () {
        var servicesCheckboxes = new Array();            
        $("input:checked").each(function () {
            //console.log($(this).val()); //works fine
            servicesCheckboxes.push($(this).val());
        });

        $.ajax({
            url: this.action,
            type: this.method,
            data: servicesCheckboxes,
            success: function (result) {
                if (result.success) {


                    }
                    else {
                    }

                }
        });
        return false;

    });
});

and here is my action method:

[HttpPost]
public ActionResult DeleteServices(int[] deleteservice)
{
   if (deleteservice != null)
   {
     //no hit
   }
}

What am I missing?

Edit

I also tried console.log(servicesCheckboxes); before $.ajax() which outputs ["3", "4"] but still get null when I pass data as specified in answer below data: { deleteservice: servicesCheckboxes }. Even I tried data: [1,2] but still action method shows null for deleteservice in action method.

  • 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-17T23:56:56+00:00Added an answer on June 17, 2026 at 11:56 pm

    Finally got it working. “MVC detects what type of data it receive by contentType” as explained here so I made the following changes to $.ajax()

    $.ajax({
    url: this.action,
    type: this.method,
    dataType: "json"
    //data: { deleteservice: servicesCheckboxes }, // using the parameter name
    data: JSON.stringify({ deleteservice: servicesCheckboxes }),
    contentType: 'application/json; charset=utf-8',
    success: function (result) {
        if (result.success) {
        }
        else {
        }    
      }
    });    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm displaying a list of items that user can select from.(multiple selection). My requirements
I am able to displaying multiple Y-axis using core plot, but my problem is
I am using the following method for displaying the multiple select box and it
I have record set where iam looping through and displaying options in select box
I am using Jquery for displaying multiple tabs in MVC 3, based on the
I am using the Infragistics jQuery grid in my ASP .NET MVC application. My
I am providing my active records below. In view/users/show I want to display any
Here I am facing a problem with the displaying of multiple pins at time
I am developing LOB application, where I will need multiple dialog windows (and displaying
Displaying Type here to ... until the user enters text into a TextBox is

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.