Very wierd Problem. Please help.

Discussion in 'ASP .Net Web Controls' started by David Lucus, Jul 7, 2003.

  1. David Lucus

    David Lucus Guest

    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
    David Lucus, Jul 7, 2003
    #1
    1. Advertising

  2. 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]

    "David Lucus" <> wrote in message
    news:...
    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
    Ken Cox [Microsoft MVP], Jul 8, 2003
    #2
    1. Advertising

  3. David Lucus

    David Lucus Guest

    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
    >
    >
    >"David Lucus" <> wrote in

    message
    >news:07ca01c344f4$59bc0870$...
    >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]
    >>
    >>"David Lucus" <> wrote in

    >message
    >>news:...
    >>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
    >>
    >>
    >>
    >>.
    >>

    >
    >
    >.
    >
    David Lucus, Jul 9, 2003
    #3
  4. 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.


    "David Lucus" <> wrote in message
    news:0d1a01c3461c$55354950$...
    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
    >
    >
    >"David Lucus" <> wrote in

    message
    >news:07ca01c344f4$59bc0870$...
    >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]
    >>
    >>"David Lucus" <> wrote in

    >message
    >>news:...
    >>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
    >>
    >>
    >>
    >>.
    >>

    >
    >
    >.
    >
    Ken Cox [Microsoft MVP], Jul 10, 2003
    #4
  5. David Lucus

    NG Guest

    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 [Microsoft MVP]" <> wrote in message
    news:#SP$...
    > 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.
    >
    >
    > "David Lucus" <> wrote in message
    > news:0d1a01c3461c$55354950$...
    > 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
    > >
    > >
    > >"David Lucus" <> wrote in

    > message
    > >news:07ca01c344f4$59bc0870$...
    > >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]
    > >>
    > >>"David Lucus" <> wrote in

    > >message
    > >>news:...
    > >>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
    > >>
    > >>
    > >>
    > >>.
    > >>

    > >
    > >
    > >.
    > >

    >
    >
    NG, Jul 10, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flores Eken
    Replies:
    1
    Views:
    330
    Flores Eken
    Dec 26, 2003
  2. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    442
    Raymond Hettinger
    Jul 27, 2003
  3. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,577
    Merrill & Michele
    Oct 19, 2004
  4. Johs32

    Very wierd problem

    Johs32, Mar 14, 2006, in forum: C Programming
    Replies:
    5
    Views:
    312
    Fred Kleinschmidt
    Mar 14, 2006
  5. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,230
Loading...

Share This Page