In gridview header write like this:
”
<HeaderTemplate>
<asp:CheckBox runat=”server” ID=”cboxhead” AutoPostBack=”true” OnCheckedChanged=”HeaderCheckedChanged”/>
</HeaderTemplate>
”
In cs file
”
protected void HeaderCheckedChanged(object sender, EventArgs e)//this is for header checkbox changed event
{
CheckBox cbSelectedHeader = (CheckBox)GridView1.HeaderRow.FindControl(“cboxhead”);//if u checked header checkbox automatically all the check boxes will be checked,viseversa
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox cbSelected = (CheckBox)row.FindControl(“CheckBox1”);
if (cbSelectedHeader.Checked == true)
{
cbSelected.Checked = true;
}
else
{
cbSelected.Checked = false;
}
}
}
“
Thank u so much…..
You´re the best! Thanks a million times!
Thanks a lot.. I didn’t think that this is so easy… well explained..
thanks a lot, nice blog.
superb
awesome dude, thnx
Thanks alot
thanks a lot… a perfect code