Very wierd Problem. Please help.

D

David Lucus

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
 
K

Ken Cox [Microsoft MVP]

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]

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
 
D

David Lucus

So I guess the answer is just work around. :)

FYI, The same problem happens in a drop down list. I am
guessing from what you say that may also be true for any
control that they use the postback in the same method.
Let me know if you hear anything else.

David

-----Original Message-----
Hi David,

Here's the explanation that I got from Microsoft:

"The asp server control relies on http post to send back the listbox
selection, which is the Value of the selected item. That's all the
information we can get from the client -- we can't get an actual list
index, and still have this control work for downlevel browser. So it's a
requirement in user code that all list items have a unique value if you
want to get the selected index.

Based on the testing, we could see that if the two item's value is the
same, the SelectedIndexChanged event won't be fired."

Ken


That would be great. Let me know what you find out, and if
you would please email any answers to my email, in case I
lose this post. :)

Thx,
David
-----Original Message-----
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]

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



.


.
 
K

Ken Cox [Microsoft MVP]

Another explanation from a fellow MVP was that the value part is like a
"primary key" for the data being held in the control and therefore you can't
have identical items.


So I guess the answer is just work around. :)

FYI, The same problem happens in a drop down list. I am
guessing from what you say that may also be true for any
control that they use the postback in the same method.
Let me know if you hear anything else.

David

-----Original Message-----
Hi David,

Here's the explanation that I got from Microsoft:

"The asp server control relies on http post to send back the listbox
selection, which is the Value of the selected item. That's all the
information we can get from the client -- we can't get an actual list
index, and still have this control work for downlevel browser. So it's a
requirement in user code that all list items have a unique value if you
want to get the selected index.

Based on the testing, we could see that if the two item's value is the
same, the SelectedIndexChanged event won't be fired."

Ken


That would be great. Let me know what you find out, and if
you would please email any answers to my email, in case I
lose this post. :)

Thx,
David
-----Original Message-----
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]

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



.


.
 
N

NG

Cheat like I do... Make your value unique by adding the text value (User
Name) to the value field (email) and strip it out when you use it on the
server side.

Ken Cox said:
Another explanation from a fellow MVP was that the value part is like a
"primary key" for the data being held in the control and therefore you can't
have identical items.


So I guess the answer is just work around. :)

FYI, The same problem happens in a drop down list. I am
guessing from what you say that may also be true for any
control that they use the postback in the same method.
Let me know if you hear anything else.

David

-----Original Message-----
Hi David,

Here's the explanation that I got from Microsoft:

"The asp server control relies on http post to send back the listbox
selection, which is the Value of the selected item. That's all the
information we can get from the client -- we can't get an actual list
index, and still have this control work for downlevel browser. So it's a
requirement in user code that all list items have a unique value if you
want to get the selected index.

Based on the testing, we could see that if the two item's value is the
same, the SelectedIndexChanged event won't be fired."

Ken


That would be great. Let me know what you find out, and if
you would please email any answers to my email, in case I
lose this post. :)

Thx,
David
-----Original Message-----
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]

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



.


.
 

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,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top