Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ropdownlist listitem.value not working - returns listitem.text instead

Reply
Thread Tools

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

 
 
Mad Scientist Jr
Guest
Posts: n/a
 
      06-28-2004
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
 
Reply With Quote
 
 
 
 
Edward
Guest
Posts: n/a
 
      06-28-2004
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



 
Reply With Quote
 
 
 
 
Mad Scientist Jr
Guest
Posts: n/a
 
      06-29-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted Returns List and Reversed Returns Iterator ++imanshu Python 7 08-23-2008 04:25 AM
Hash#select returns an array but Hash#reject returns a hash... Srijayanth Sridhar Ruby 19 07-02-2008 12:49 PM
createImage sometime returns null and sometime returns non-null. vizlab Java 3 10-17-2007 11:21 AM
block returns and hash element returns Trans Ruby 2 11-06-2005 12:15 PM
dr("field").toString returns "400.0000" instead of "400" Dan C Douglas ASP .Net 5 07-22-2003 05:48 PM



Advertisments