In the GridView, there are a series of checkboxes. to select all or all of them, there are no such items and requirements on the Internet, so I wrote the JavaScript code myself, post it for your reference. There are a series of checkboxes in the GridView. You need to select all or none of them. I found it online, but the reference code Selects all the checkboxes in the GridView, and I want all of them in a single column.
Audit and permissions must be separated.
I wrote JavaScript code and posted it for your reference.
The Code is as follows:
Function chkAll (CheckAll ){
Var items = document. getElementsByTagName ("input ");
For (var I = 0; I <items. length; I ++ ){
If (items [I]. type = "checkbox "){
For (var j = 2; j <10; j ++ ){
Var id = "ctl00_ContentPlaceHolder1_GridView1_ctl0" + j + "_ CheckBox1 ";
If (items [I]. id = id ){
Items [I]. checked = CheckAll. checked;
}
}
}
}
}
The IDS of Row j and row 5th of row 6th are used to determine the Checkbox of the same column. The range and id of the specific column j may be different. You can use alert (items [I]. id); traverse the entire items to view the corresponding id.
The front-end code is as follows:
The Code is as follows:
Review
'Runat = "server"/>