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

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

Post by usenet_dau » Tue, 29 Jun 2004 23:13:53


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
 
 
 

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

Post by Edwar » Tue, 29 Jun 2004 23:35:55

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.

 
 
 

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

Post by usenet_dau » Wed, 30 Jun 2004 22:13:36

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