469,658 Members | 1,844 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

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

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
Nov 18 '05 #1
2 2077
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

Nov 18 '05 #2
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
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by tornado | last post: by
4 posts views Thread by mg | last post: by
4 posts views Thread by Shaul Feldman | last post: by
4 posts views Thread by Sparky Arbuckle | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
4 posts views Thread by Kevin Blount | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.