Bug in Listbox and Dropdownlist

D

David Lucus

This was an earlier post, but I have found some more
information. The same error occurs on dropdownlist as
well as Listbox. Here is some sample code that I got it
to break on. The page just has 1 dropdownlist that post
back on selected item change. Ken if you need any other
information, please let me know. If there is an error in
my code, please let me know that too. :)

Here are the values of the dropdownlist
text value
st -1
item1 1
item2 2
item3 1

Here is the code used to find the selected values.
Dim item As ListItem
Dim s As String = ""
For Each item In DropDownList1.Items
If item.Selected Then
s += item.Text & "\n"
End If
Next
Response.Write("<script language='JavaScript'>alert
('Values Selected\n" & s & "');</script>")

I am just using the JavaScript to give me a popup of the
selected items.

---Previous Thread---

I find it weird too. I've asked some MS guys about and
will get back to you
with the explanation.

Ken
MVP [ASP.NET]

message
I have never seen this before. I have a listbox that I
allow multiple
selection in. It is populated with User names and their
email address is
used for the value. Some of these users have the same
email address (common
mailbox). Here is the problem.

User A and User B both have the same email for their item
value.

user A proceeds user B in the list.

If I select User B and then ask what item has been
selected, it tells me
that it was User A. It gives me User A's index, text, and
value.

Has anyone else seen this before???? If so, how did you
get around this?

Also fyi, if the users have different "value" fields there
is no problem.

David



..
 
C

Charles

the value in the "value" field of the dropdownlist/listbox
should be distinct. it's actually the tag field in vb for
the listview/imgcbobox. it's users' duty to meet this
requirement, or u will get the wierd turning out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top