I have a checkboxlist on a form that is populated by a databind. The
users need to be able to change previous checks they made to the
checkboxlist. First they enter in their info, and the the db goes to
look up what items in the checklist they have selected before. I
know how to GET the selected items, but I can't seem to SET the
items to have a checkmark in them if certain criteria is met (i.e.
the listitem value equals the value we're looping through in the
database via a datareader. I tried setting the listitem.selected =
true, but the checkboxes still aren't checked in the checkboxlist,
even though the value from the checkboxlist index equals the db
value. Here's the code I tried:
(for each listItem in the checkboxlist)
For Each li In Me.chkEvents.Items
(if the listitem value (i.e. 1, 2, etc) equals the
datareader(field index) value (i.e. 1, 2, etc) then
set it to Selected)
If li.Value = tmpDRValue Then
chkEvents.Items(li.Value).Selected = True
End If
Next
I know they are matching, because this If then evaluates to true
when the values do match. It just doesn't put a checkmark into the
checkbox in the list. Can anyone help