Add a clear-selected Checkbox control on the DataGrid header

xiaoxiao2021-03-06  150

Very simple method, use JS implementation:

page:

< / Headertemplate>

Headertext = "Department"> Background code:

private void dgUserList_PreRender (object sender, System.EventArgs e) {foreach (DataGridItem item in dgUserList.Controls [0] .Controls) {if (item.ItemType == ListItemType.Header) {CheckBox chkAll = (CheckBox) item.FindControl ( "chkAll"); System.Text.StringBuilder strScript = new System.Text.StringBuilder ( "