C# 实现批量删除功能
2021-01-03 09:27
标签:rip NPU class hang code join inpu rem ati C# 实现批量删除功能 标签:rip NPU class hang code join inpu rem ati 原文地址:https://www.cnblogs.com/BlackAgg/p/13207806.htmlinput type="submit" class="btn btn-info" onclick="DelAll()" value="批量删除" />
table class="table table-striped" id="table">
tr>
td>input id="cb_selAll" type="checkbox" />td>
td>IDtd>
tr>
tbody id="tb_body">
@foreach (var item in Model)
{
tr>
td>input type="checkbox" value="@item.id" class="cb_fruit" />td>
td id="id">@item.idtd>
tr>
}
tbody>
table>
script>
$(function () {
$("#cb_selAll").change(function () {
$("#tb_body :checkbox").prop("checked", this.checked);
});
});
function DelAll() {
var id = [];
$("#tb_body :checkbox:checked").each(function () {
id.push($(this).val());
});
$.ajax({
url: "/Employees/DelAll",
type: "GET",
data: { id: id.join(",") },
success: function (data) {
if (data > 0) {
alert("成功!");
$("#tb_body :checkbox:checked").parent().parent().remove();
location.reload();
} else {
alert("失败!");
}
},
error: function () {
alert("系统繁忙!");
}
});
}
script>
///
下一篇:redis在C#中的使用