Dropdown list control problem

Discussion in 'ASP .Net Web Controls' started by Jerry, Sep 29, 2004.

  1. Jerry

    Jerry Guest

    I have a dropdown list and I am linking it to a database
    table called "Product". The fields in the database are
    ProductID (PK), price, and description. I am assigning
    the description field from the DB to the text field (what
    gets displayed) in the dropdown. I am assigning the
    price from the DB to the Value in the dropdown list.


    Data:
    the second item in the list has a price of 10.00 and the
    fourth item in the list also has a price of 10.00. All
    of the other prices are different.

    Problem: When you click the fourth item the second item
    is displayed. So it appears that .NET is using the value
    field and displaying the first record it sees with that
    value rather than using the index of the dropdown list.
    This seems to me to be a .NET bug.

    Any ideas?

    Thanks,

    Jerry
    Jerry, Sep 29, 2004
    #1
    1. Advertising

  2. You never get the index. DropDown list's property SelectedItemIndex gets set
    according to value field returned.

    You could either:
    1. inherit this control and appropriately set SelectedItemIndex acording to
    Value & Text

    2. It's actually strange to put something nonunique in the Value filed.
    Change the Value field or concat it with a unique value and split both
    values on the server to get the correct item index.

    --
    RobertK
    { Clever? No just smart. }

    "Jerry" <> wrote in message
    news:3dc801c4a663$b5765220$...
    > I have a dropdown list and I am linking it to a database
    > table called "Product". The fields in the database are
    > ProductID (PK), price, and description. I am assigning
    > the description field from the DB to the text field (what
    > gets displayed) in the dropdown. I am assigning the
    > price from the DB to the Value in the dropdown list.
    >
    >
    > Data:
    > the second item in the list has a price of 10.00 and the
    > fourth item in the list also has a price of 10.00. All
    > of the other prices are different.
    >
    > Problem: When you click the fourth item the second item
    > is displayed. So it appears that .NET is using the value
    > field and displaying the first record it sees with that
    > value rather than using the index of the dropdown list.
    > This seems to me to be a .NET bug.
    >
    > Any ideas?
    >
    > Thanks,
    >
    > Jerry
    >
    >
    Robert Koritnik, Sep 30, 2004
    #2
    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. Manish
    Replies:
    0
    Views:
    318
    Manish
    Aug 12, 2003
  2. vishnu
    Replies:
    1
    Views:
    1,203
    Patrick.O.Ige
    Mar 25, 2006
  3. Mike
    Replies:
    1
    Views:
    803
  4. acadam
    Replies:
    0
    Views:
    755
    acadam
    Dec 27, 2006
  5. M. Craig
    Replies:
    1
    Views:
    744
    Victor Garcia Aprea [MVP]
    Jan 9, 2004
Loading...

Share This Page