ropdownlist listitem.value not working - returns listitem.text instead

Discussion in 'ASP .Net' started by Mad Scientist Jr, Jun 28, 2004.

  1. I am populating a dropdownlist from SQL. The query returns the correct
    values (and no NULLs in any fields). The listitem.value is populated
    with an int ID field, and listitem.text with a varchar description
    field. The problem is, for some reason, I cannot access the numeric ID
    after item #5 in the dropdown box.
    After item #5, if I try to read the ListItem.value, I get the
    ListItem.text. If I run the query in Query Analyzer, I can see the
    values all are there (none are NULL), and should be populated in the
    dropdown. I am using VS.NET 2003 and SQL 2000. Has anyone seen an
    error such as this? Is there a limit to the size of a dropdownlist? I
    am using IE 6. Thanks...

    Here is what I get when I traverse the dropdownlist contents:

    Ordinal ListItem1.value ListItem1.text
    ------------------------------------------------
    0001 -1 Select One ...
    0002 98404 My List Item 1
    0003 65370 My List Item 2
    0004 89438 My List Item 3
    0005 4440 My List Item 4
    0006 My List Item 5 My List Item 5
    0007 My List Item 6 My List Item 6
    0008 My List Item 7 My List Item 7
    ....
    0517 My List Item 516 My List Item 516
    0518 My List Item 51 My List Item 517
     
    Mad Scientist Jr, Jun 28, 2004
    #1
    1. Advertising

  2. Mad Scientist Jr

    Edward Guest

    I've never met such problem, everything is ok in my app.

    so can you paste the Dropdownlist loading code here, let's have a look.

    > I am populating a dropdownlist from SQL. The query returns the correct
    > values (and no NULLs in any fields). The listitem.value is populated
    > with an int ID field, and listitem.text with a varchar description
    > field. The problem is, for some reason, I cannot access the numeric ID
    > after item #5 in the dropdown box.
    > After item #5, if I try to read the ListItem.value, I get the
    > ListItem.text. If I run the query in Query Analyzer, I can see the
    > values all are there (none are NULL), and should be populated in the
    > dropdown. I am using VS.NET 2003 and SQL 2000. Has anyone seen an
    > error such as this? Is there a limit to the size of a dropdownlist? I
    > am using IE 6. Thanks...
    >
    > Here is what I get when I traverse the dropdownlist contents:
    >
    > Ordinal ListItem1.value ListItem1.text
    > ------------------------------------------------
    > 0001 -1 Select One ...
    > 0002 98404 My List Item 1
    > 0003 65370 My List Item 2
    > 0004 89438 My List Item 3
    > 0005 4440 My List Item 4
    > 0006 My List Item 5 My List Item 5
    > 0007 My List Item 6 My List Item 6
    > 0008 My List Item 7 My List Item 7
    > ...
    > 0517 My List Item 516 My List Item 516
    > 0518 My List Item 51 My List Item 517
     
    Edward, Jun 28, 2004
    #2
    1. Advertising

  3. Found the problem.
    This behavior was caused by a NULL value getting stuck into the 6th
    element's ListItem.value field. All elements in the dropdown after
    that came up NULL, even if I had explicitly assigned them a value.

    So anyone with dropdown list problems, remember to check for
    * non-unique ListItem.values
    * NULL ListItem.values
     
    Mad Scientist Jr, Jun 29, 2004
    #3
    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. Joey
    Replies:
    3
    Views:
    3,114
    =?Utf-8?B?UnlhbiBSaWRkZWxs?=
    Aug 6, 2004
  2. vizlab
    Replies:
    3
    Views:
    4,253
    Michael Bar-Sinai
    Oct 17, 2007
  3. Jim in Arizona
    Replies:
    7
    Views:
    964
    Badass Scotsman
    Nov 22, 2006
  4. ++imanshu
    Replies:
    7
    Views:
    490
    ++imanshu
    Aug 23, 2008
  5. Ron
    Replies:
    3
    Views:
    446
    Steven Cheng[MSFT]
    Oct 8, 2004
Loading...

Share This Page