<script type="text/javascript">
function selectAll(invoker) {
var inputElements = document.getElementsByTagName('input');
for (var i = 0; i < inputElements.length; i++) {
var myElement = inputElements[i];
if (myElement.type === "checkbox") {
myElement.checked = invoker.checked;
}
}
}
</script>
HTML------------------
<asp:TemplateField HeaderText="Select">
<AlternatingItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</AlternatingItemTemplate>
<HeaderTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" OnClick="selectAll(this)" />
Select
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
<ItemStyle Width="100px" />
</asp:TemplateField>
No comments:
Post a Comment