I work on razor asp.net i face issue i can't update all values checked on table example
so suppose i checked 5 rows witth id 45,67,57,80
so i need to get these id then update it on table from table html
table html details
JavaScript
Reprint
EntredDatetime
OrderType
OrderNo
PrinterName
BranchCode
Status
Id
@foreach (var reprint in Model.Reprintslist)
{
@reprint.LoggedDate
@reprint.OrderType
@reprint.OrderNo
@reprint.PrinterName
@reprint.BranchCode
@reprint.Status
@reprint.id
}
what i try
JavaScript
$('#reprintdatabtn').click(function () {
var dataArr = [];
$('input:checked').each(function () {
dataArr.push($(this).attr('id')); // insert rowid's to array
});
console.log(dataArr);image for what i need as below


Amit MohantyRank #112 · 20K reputationPosted Jun 20, 2023, 8:36 AM EDT
Try this:
$('#reprintdatabtn').click(function () { var dataArr = []; $('.myCheckbox:checked').each(function () { var id = $(this).closest('tr').find('td#idval').text(); dataArr.push(id); }); console.log(dataArr); // Now you can perform the update operation with the retrieved IDs });ahmed salahRank #2,240 · 628 reputationPosted Jun 20, 2023, 12:23 PM EDT
can you please tell me how to make update with on post razor page model please to make update
Amit MohantyRank #112 · 20K reputationPosted Jun 21, 2023, 1:38 AM EDT
public IActionResult OnPostUpdateRows(List ids) { // Perform the update operation using the provided IDs return Ok("Update successful"); }$('#reprintdatabtn').click(function () { var dataArr = []; $('.myCheckbox:checked').each(function () { var id = $(this).closest('tr').find('td#idval').text(); dataArr.push(id); }); // Send an AJAX request to the server $.ajax({ url: '/pagename?handler=/UpdateRows', type: 'POST', data: { ids: dataArr }, success: function (response) { console.log(response); // Handle the response from the server }, error: function (xhr, status, error) { console.log(xhr.responseText); // Handle the error } }); });