<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllOrUnSelectAll(this)"
Text="SelectAll" TextAlign="Left" ToolTip="选中所有的Item" />
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllOrUnSelectAll(this)"
Text="SelectAll" TextAlign="Left" ToolTip="选中所有的Item" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
function SelectAllOrUnSelectAll(object)
{
var form = document.forms["form1"];
var i = 0;
var loop = 0;
for (loop=0; loop < form.elements.length; loop++)
{
if(form.elements[loop].type == "checkbox" && object.checked)
{
form.elements[loop].checked = true;
}
else if(form.elements[loop].type == "checkbox" && !object.checked)
{
form.elements[loop].checked = false;
}
}
return true;
}
</script>