473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2189
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
4
by: mg | last post by:
How can I change the color of the display text beside a single ListItem of a RadioButtonList when the associated radiobutton is selected - hopefully using C# in the codebehind of a WebForm? ...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
4
by: Harold | last post by:
I have read the following article http://www.4guysfromrolla.com/webtech/073101-1.shtml. I added the empty selection as the first option. When I click submit without choosing anything it does not...
4
by: Sparky Arbuckle | last post by:
I am looping through a listbox collection to build a SQL string that will be used to delete items from a database. I have tried many variances of the code below but have had no luck. The code below...
3
by: Nathan Sokalski | last post by:
I want to change the background color, font attributes, etc. of the choices in my DropDownLists. When writing them using HTML SELECT and OPTION tags, I can do something like the following: ...
4
by: Kevin Blount | last post by:
As mentioned before, I'm creating a multi-lingual page where the text of the page comes from a database. This page includes a registration form which asks for address information, including the...
5
by: ssmeshack | last post by:
Hi All, Im using VWD 2008 (c#), I have a question here. Im having a dropdownlist like this: <asp:DropDownList ID="ddlIssue" runat="server" AutoPostBack="True" ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.