Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

ASP.net VB.net Get the Index of an Item checked in a dynamically added CheckBoxList

Hi
I am trying to get the Index of an Item checked in a dynamically added CheckBoxList. I use the following code and
myCheckBoxListName  and myNewValue work just fine but oIndex returns -1 every time

  Private Sub HandleCheckBoxListOnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

            Dim myCheckBoxListName As String
            Dim myNewValue As String
            Dim oIndex As Integer

            myNewValue = DirectCast(sender, CheckBoxList).SelectedValue
            oIndex = DirectCast(sender, CheckBoxList).SelectedIndex
            myCheckBoxListName = DirectCast(sender, CheckBoxList).ID
End Sub
ASP.NET.NET Programming

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon