<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>gridview控件示例</title>
<link href="App_Themes/Theme1/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
function DoCheck(flag)// 全选 flag=1 反选 flag=0
{
var inputs = document.getElementById("gvDiv");
var chks=inputs.getElementsByTagName("input");
for (var i=0; i < chks.length; i++)
if (chks[i].type == 'checkbox')
{
chks[i].checked=flag;
}
}
</script>
</head>
<body >
<form id="form1" runat="server">
<div id="gvDiv">
<asp:GridView id="gvMyDeptNotFinished" runat="server" OnPageIndexChanging="gvMyDeptNotFinished_PageIndexChanging" AllowPaging="True" AutoGenerateColumns="False" SkinID="gvcaselist">
<Columns>
<asp:TemplateField Visible="false" >
<ControlStyle Width="20px" />
<HeaderTemplate>
<a onclick="DoCheck(0);" href="#">反选</a> <%--反选--%>
<a onclick="DoCheck(1);" href="#">全选</a> <%--全选--%>
</HeaderTemplate>
<ItemTemplate>
</div>
</form>
</body>
</html>