Add a clear-selected Checkbox control on the DataGrid header

xiaoxiao2021-03-06  50

Very simple method, use JS implementation:

page:

AllowPaging = "true" allowsorting = "true" autogeneratecolumns = "false">

Backstage 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 ("