How to uncheck header checkbox in GridView when sorting and paging?
Posted
by OutOFTouch
on Stack Overflow
See other posts from Stack Overflow
or by OutOFTouch
Published on 2010-03-13T23:22:29Z
Indexed on
2010/03/13
23:25 UTC
Read the original article
Hit count: 220
Hi,
I followed this article and it works great except when paging or sorting the HeaderCheckBox is still checked. How and where should this be unchecked? I think it would be best to uncheck it in the control itself, but I am not having any luck even getting a reference to it using this code:
protected override void OnSorted(EventArgs e)
{
base.OnSorted(e);
if (AutoGenerateCheckBoxColumn)
{
CheckBox cb = (CheckBox) HeaderRow.FindControl(String.Format(HeaderCheckBoxId, ClientID));
if(cb != null)
{
cb.Checked = false;
}
}
}
Thanks
© Stack Overflow or respective owner