I am assuming that we have a Gridview control with Checkboxes inside it.
Now,write a javascript code as
<script type="text/javascript" language="javascript">
function Check_UncheckAll(Checkbox)
{
var Grid_vw_Emp = document.getElementById("<%=grid_emp.ClientID %>");
for (i = 1;i<= Grid_vw_Emp.rows.length-1;i++)
{
Grid_vw_Emp.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
}
}
</script>
Here,cells[0] means 0 index that is Checkbox index position. Call above Javascript method on
Checkbox OnClick event as:-
<HeaderTemplate>
<asp:CheckBox ID="chkboxSelectAll" runat="server" onclick = "Check_UncheckAll(this);" />
</HeaderTemplate>