determines if checkbox control inside datalist is checked
The code determines if checkbox control inside datalist is checked or unchecked, then do something depending on the status of the checkbox. It will also get the value of the chosen data.
The following code can be inserted on any control event:
Dim list As DataListItem
For Each list In myDataList.Items
Dim thechkbx As CheckBox = list.FindControl("myCheckBox")
If thechkbx IsNot Nothing AndAlso thechkbx.Checked AndAlso thechkbx.Enabled Then
Dim myDataKey As String = Me.myDataList.DataKeys(list.ItemIndex).ToString()
(do something here)
Else
(do something here)
End If
Next