Listbox in asp.net not getting selected items

前端 未结 5 1066
花落未央
花落未央 2021-01-14 10:41

I have multiple dropdown & listbox in my webpage.

I am trying to get a list of CategoryID from a lstCatID listbox i am able to populate

5条回答
  •  臣服心动
    2021-01-14 11:10

    Minutes later I found a solution:

    If lstLocations.Items.Count > 0 Then
                For i As Integer = 0 To lstLocations.Items.Count - 1
                    If lstLocations.Items(i).Selected Then
                        'insert command
                        Dim selectedItem As String = lstLocations.Items(i).Text
                    End If
                Next
            End If
    

    This worked fine in my scenario

提交回复
热议问题