Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
MonthlyLeaders
ASK A QUESTION
Forumguidelines
Sourabh Dhiman
1.4k
566
28.6k
face a null value.
Nov 26 2020 12:36 AM
I have use this code for delete multiple entry on button click.But i have face null value(Id).Please check this code
It's me jquery code
function confirmDelete() {
debugger;
var EducationalId = [];
$(".chk:checked").each(function (i, y) {
debugger;
EducationalId.push($(this).val());
});
swal({
title: "Confirmation?",
text: "Are you sure you want to delete record?",
type: "warning",
confirmButtonClass: "btn-danger",
showCancelButton: true,
confirmButtonText: "Yes",
closeOnConfirm: false
},
function (isConfirm) {
if (!isConfirm) return;
$.ajax({
url: "DeleteImageData",
type: "POST",
data: JSON.stringify(EducationalId),
contentType: 'application/json; charset=utf-8',
datatype: 'json',
success: function () {
swal({
title: "Done", text: "Image deleted successfully",
type: "success"
}, function () {
location.reload();
});
},
error: function (xhr, ajaxOptions, thrownError) {
swal("Error deleting!", "Please try again", "error");
}
});
});
};
it's me mvc code public IActionResult DeleteImageData(int[]
EducationalId)
Here we have face a issue (Id is 0)
it's me button click
<button type="submit" class="btn btn-danger btndelete" onclick="confirmDelete()" id="@Model.EducationalId"><i class="fa fa-trash"></i> Delete</button>
Please check this
Reply
Answers (
5
)
how to give date format for datacolumn of datatable in asp.net
How to make general search in Dashboard