How to implement Checkbox, which is incorporated in the Header added in Datalist (DataGrid), and performs a total selection or a

zhaozj2021-02-16  55

First add , then join JavaScript in in JavaScript in

function ll (flag) {if (document.Form1.DataList2__ctl1_CheckBox1 = null!) {document.Form1.DataList2__ctl1_CheckBox1.checked = flag;} if (! document.Form1.DataList2__ctl2_CheckBox1 = null) {document.Form1.DataList2__ctl2_CheckBox1.checked = flag ;} if (document.Form1.DataList2__ctl3_CheckBox1 = null!) {document.Form1.DataList2__ctl3_CheckBox1.checked = flag;} if (document.Form1.DataList2__ctl4_CheckBox1 = null!) {document.Form1.DataList2__ctl4_CheckBox1.checked = flag;} if ( ! document.Form1.DataList2__ctl5_CheckBox1 = null) {document.Form1.DataList2__ctl5_CheckBox1.checked = flag;}! if (document.Form1.DataList2__ctl6_CheckBox1 = null) {document.Form1.DataList2__ctl6_CheckBox1.checked = flag;} if (document.Form1. ! DataList2__ctl7_CheckBox1 = null) {document.Form1.DataList2__ctl7_CheckBox1.checked = flag;} if (document.Form1.DataList2__ctl8_CheckBox1 = null)! {document.Form1.DataList2__ctl8_CheckBox1.checked = flag;}! if (document.Form1.DataList2__ctl9_CheckBox1 = null ) {docuagent.form1.datalist2__ctl 9_checkbox1.checked = flag;} if (Document.form1.datalist2__ctl10_checkbox1! = Null) {document.form1.datalist2__ctl10_checkbox1.checked = flag;}}

The key to implementation is how to determine the name of Checkbox in DataList

As an example, I defined the DataList per page display 10 lines, where Datalist's name: DataList2, Checkbox's name: checkbox1, checkbox is the first column, then the name in the checkbox column is DataList2__ctl _Checkbox1, "?" Is from 1 start increment

转载请注明原文地址:https://www.9cbs.com/read-23981.html

New Post(0)