Select Multiple Rows From jTable And Delete Using ASP.NET MVC

Introduction

In this article, I will explain to you how you can delete multiple records from jTable using MVC. But before preceding further in this article please read my previous two articles because this article is completely based on them. 
Let's start multiple selection and delete selected records. Here are the steps:
 
Step 1:

Enable selection for jTable on click of particular row. Open Script.js file and set selecting property as true.

 

After applying  this you can run your project and click on any row that will be selected but you will not able to select multiple rows at a time. You can see the following figure for this.
 
Step 2: For multiple selection set multiselect property as true in Script.js File. Here's the screenshot,

 
After doing this you can run the project and you will get output as below where you can select multiple rows by clicking on rows.
 
Step 3: Now, I am adding checkboxes for multiple selection by setting selectingCheckboxes property to true in Script.js. Here's the screenshot,

 
 
After adding checkboxes run your project and you can see your output will be as in the following,

 
Step 4: Now add a button for deleting Multiple rows in index.cshtml of Marks folder. Here's the screenshot,

 
Step 5: After Adding this button write the delete functionality for this button in Script.js File. 
 
Code for delete functionality when clicking on multiple records (in Script.JS). Code will be as in the following figure:

 
Step 6: Build the project and run it by pressing F5. Output will be as in the following:
  • Firstly, select multiple fields as in the following figure:


  • Then Press Delete All Selected Marks Button.

  • After deleting selected rows,


    You can see there was 51 records in the records before deleting now we have 47 records because we have deleted 4 records. Roll Number 11, Roll Number 14, Roll Number 17, Roll Number 19, is deleted from the record.
 
Read more articles on ASP.NET:


Similar Articles