try the following code, its working fine for me
protected void chekSelectALL_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkA = GridView1.HeaderRow.FindControl("chekSelectALL") as CheckBox;
foreach (GridViewRow gv in GridView1.Rows)
{
CheckBox chkS = gv.FindControl("chekSelect") as CheckBox;
if (chkA.Checked)
{
chkS.Checked = true;
}
else
{
chkS.Checked = false;
}
}
}