Im having a problem with my checkbox list. I’m able to loop though it, but I can not seem to find that items are checked. Im coding this in VB.net 2010 and asp.net In my for each i always get False on selected.
Here is some of my code:
Protected Sub cmdSend_Click(sender As Object, e As System.EventArgs) Handles cmdSend.Click
'Check for checked users.
Dim lqText As New lqAlarmAndGoDataContext
Try
For Each foundCheckedUser In cbMembers.Items
If foundCheckedUser.Selected Then
Dim objText As New tbTxtMessageQueue
With objText
.TxtFrom = "txt@123.com"
.TxtTo = foundCheckedUser.value
.TxtBoddy = tbMessage.Text
.SentFlag = False
End With
lqText.tbTxtMessageQueues.InsertOnSubmit(objText)
lqText.SubmitChanges()
End If
Next
Catch ex As Exception
End Try
End Sub
Where do you bind your data to the checkbox?
Make sure it’s not being rebinded before the button onclick by using
Also, make sure your viewstate are enabled