给个在DataGrid中控制CheckBox的例子: Dim _item As DataGridItem Dim CheckBoxa As CheckBox For Each _item In DataGrid1.Items CheckBoxa = CType(_item.FindControl("CB"), CheckBox) '接收DataGrid 中CheckBox的参数 If Not CheckBoxa Is Nothing Then If CheckBoxa.Checked Then Dim number As String = _item.Cells(0).Text ...... cmd.ExecuteNonQuery() End If End If Next
Dim _item As DataGridItem
Dim CheckBoxa As CheckBox
For Each _item In DataGrid1.Items
CheckBoxa = CType(_item.FindControl("CB"), CheckBox) '接收DataGrid 中CheckBox的参数
If Not CheckBoxa Is Nothing Then
If CheckBoxa.Checked Then
Dim number As String = _item.Cells(0).Text
......
cmd.ExecuteNonQuery()
End If
End If
Next