K
K B
Hi, The following code has been successful for me in the past and i just
can't figure out where I'm going wrong. When I debug I keep getting the
two top items as selected even though there are not selected and the
selected items are ignored. I'm using ASP.NET 2.0 and using two server
listbox controls. Any help appreciated.
Kit
Dim item As ListItem
Dim check As ListItem
For Each item In lstSelect.Items
If item.Selected = True Then
'check if value already exists in lstTo
check = lstTo.Items.FindByValue(item.Value)
If Not check Is Nothing Then
Exit Sub
Else
lstTo.Items.Add(New ListItem(item.Text, item.Value))
End If
End If
Next
can't figure out where I'm going wrong. When I debug I keep getting the
two top items as selected even though there are not selected and the
selected items are ignored. I'm using ASP.NET 2.0 and using two server
listbox controls. Any help appreciated.
Kit
Dim item As ListItem
Dim check As ListItem
For Each item In lstSelect.Items
If item.Selected = True Then
'check if value already exists in lstTo
check = lstTo.Items.FindByValue(item.Value)
If Not check Is Nothing Then
Exit Sub
Else
lstTo.Items.Add(New ListItem(item.Text, item.Value))
End If
End If
Next