全选取消批量删除

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了全选取消批量删除相关的知识,希望对你有一定的参考价值。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IndexSum.aspx.cs" Inherits="Supplier.Later.IndexSum" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="../Css/admin.css" rel="stylesheet" type="text/css" />
<link href="../Css/pintuer.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/pintuer.js" type="text/javascript"></script>
<script src="../Scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function checkAll(name) {
var el = document.getElementsByTagName(‘input‘);
var len = el.length;
for (var i = 0; i < len; i++) {
if ((el[i].type == "checkbox") && (el[i].name == name)) {
el[i].checked = true;
}
}
}
function clearAll(name) {
var el = document.getElementsByTagName(‘input‘);
var len = el.length;
for (var i = 0; i < len; i++) {
if ((el[i].type == "checkbox") && (el[i].name == name)) {
el[i].checked = false;
}
}
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div class="panel admin-panel">
<div class="panel-head">
<strong class="icon-reorder">收发汇总表</strong></div>
<div class="padding border-bottom">
<ul class="search">
<li>

<input type="button" value="全选" style="width: 50px" onclick="checkAll(‘test‘)" />
<input type="button" value="取消全选" style="width: 70px" onclick="clearAll(‘test‘)" />
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" Font-Size="9pt" OnCheckedChanged="CheckBox2_CheckedChanged"
Text="全选" Width="54px" />

 

<asp:Button ID="Button3" runat="server" Width="70px" Text="批量删除" OnClick="Button3_Click" />


<asp:Label ID="Label1" runat="server" Text="按供应商查询"></asp:Label>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="Button4" runat="server" Width="60px" Text="确认" OnClick="Button4_Click" />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button5" runat="server" Width="60px" Text="导入" OnClick="Button5_Click" />
<asp:Button ID="Button6" runat="server" Width="60px" Text="导出" OnClick="Button6_Click" />
</li>
</ul>
</div>
<table class="table table-hover text-center">
<tr>
<th>

<input type="checkbox" runat="server" name="test" onclick="if(this.checked==true) { checkAll(‘test‘); } else { clearAll(‘test‘); }" />
</th>
<th>
选择
</th>
<th width="30px">
序号
</th>
<th width="70px">
会计期间
</th>
<th width="80px">
发料仓库
</th>
<th width="80px">
物料长代码
</th>
<th width="180px">
物料名称
</th>
<th width="40px">
单位
</th>
<th width="60px">
期初结存
</th>
<th width="60px">
本期到货
</th>
<th width="60px">
本期发出
</th>
<th width="60px">
期末结存
</th>
<th width="80px">
供应商代码
</th>
<th width="180px">
供应商名称
</th>
<th width="150px">
备注
</th>
<th width="50px">
删除
</th>
</tr>
<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<tr style="text-align: center">
<td>
<%--<asp:CheckBox ID="CheckBox1" runat="server" />--%>
<asp:CheckBox ID="CheckBox1" runat="server" ToolTip=‘<%#Eval("id") %>‘ Font-Size="9pt" Height="10px" Width="10px" />
<input id="cdDelete" type="checkbox" name="test" <td>
<%#Eval("Id")%>
</td>
<td>
<%#Eval("KJQJ")%>
</td>
<td>
<%#Eval("FLCK")%>
</td>
<td>
<%#Eval("WLCDM")%>
</td>
<td>
<%#Eval("WLMC")%>
</td>
<td>
<%#Eval("DW")%>
</td>
<td>
<%#Eval("QCJC")%>
</td>
<td>
<%#Eval("BQDH")%>
</td>
<td>
<%#Eval("BQFC")%>
</td>
<td>
<%#Eval("QMJC")%>
</td>
<td>
<%#Eval("SId")%>
</td>
<td>
<%#Eval("SName")%>
</td>
<td>
<%#Eval("Remark")%>
</td>
<td>
<img src="../images/del.gif" width="16" height="16" />
<asp:LinkButton ID="btn_Del" runat="server" Text="删除" CommandName="del" CommandArgument=‘<%#Eval("ID")%>‘
OnClientClick="return confirm(‘确定删除吗?‘);" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td colspan="15">
<div align="center">
<table>
<tr>
<td>
共有
<asp:Label ID="lblRowsCount" runat="server" Text=""></asp:Label>
条记录,共
<asp:Label ID="lblPageCount" runat="server" Text=""></asp:Label>
页,当前第
<asp:Label ID="lblPageIndex" runat="server" Text="1"></asp:Label>

</td>
<td>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="40">
<asp:ImageButton ImageUrl="~/images/first.gif" ImageAlign="AbsMiddle" ID="btnF" runat="server"
Style="height: 15px" OnClick="btnF_Click" />
</td>
<td class="style1">
<asp:ImageButton ImageUrl="~/images/back.gif" ImageAlign="AbsMiddle" ID="btnP" runat="server"
OnClick="btnP_Click" />
</td>
<td width="45">
<asp:ImageButton ImageUrl="~/images/next.gif" ID="btnN" runat="server" Style="text-align: right"
ImageAlign="AbsMiddle" OnClick="btnN_Click" />
</td>
<td width="40">
<asp:ImageButton ImageUrl="~/images/last.gif" ID="btnL" runat="server" Style="text-align: right"
ImageAlign="AbsMiddle" OnClick="btnL_Click" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

以上是关于全选取消批量删除的主要内容,如果未能解决你的问题,请参考以下文章

用户管理的设计--8.批量用户信息删除

java实现多选批量删除

AJAX实现弹窗显示详情,全选和批量删除

php--jquery操作全选批量删除加减行

全选+批量删除

jQuery实现全选/反选和批量删除