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

M

Mad Scientist Jr

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
 
E

Edward

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.
 
M

Mad Scientist Jr

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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top