This is one way to do it. Maybe not the cleanest but it works. There is a way to do it in the itemDatabound
1. Make a function to create the checkboxes.
2. Make a function to check or uncheck the check boxes like the example below which refers to the check box list created in the first function - cblEmpIDView.
Function getWhatever()
Dim SQL As String = "SELECT statement to find out which check boxes should be checked.";"
Dim oDA As New SqlDataAdapter(SQL, _oConn)
Dim oDS As New DataSet
oDA.Fill(oDS)
For Each i As DataRow In oDS.Tables(0).Rows
Dim n As ListItem = cblEmpIDView.Items.FindByValue(i("EmpID"))
If Not n Is Nothing Then
n.Selected = True
End If
Next
End Function
|