I wnat to have checkbox in Gridview Header. On the checkbox changed I wnat to check and uncheck all the checkboxes of the Gridview Rows. Currently I am doing it on the button click. But I want to have checkbox in Gridview header, How to have checkbox in Gridview Header,can somebody tell me??
Code:
protected void btnCheckAll_Click(object sender, EventArgs e)
    {
        Check_Uncheck_Checkboxes(true);
    }
    protected void btnunCheckAll_Click(object sender, EventArgs e)
    {
        Check_Uncheck_Checkboxes(false);
    }

    private void Check_Uncheck_Checkboxes(bool bState)
    {
        CheckBox chk;
        foreach (GridViewRow rowItem in GrdCompanies.Rows)
        {
            chk = (CheckBox)(rowItem.Cells[1].FindControl("chkSelect"));
            chk.Checked = bState;
           
        }
    }