PC Review


Reply
Thread Tools Rate Thread

C# Two-Column Dropdown List: Need help

 
 
JJ_377@hotmail.com
Guest
Posts: n/a
 
      1st Sep 2006
I am trying to populate a two-column dropdown list from a populated
datareader (dr) having two fields from the Categories table of the
Northwind database: CategoryID and CategoryName.

I've used this type of construction successfully with VB.NET (from
which I am now transistioning...) and it has worked unfailingly with my
dropdowns there.

However, when I do this in C#, the result is only the CateogryID
displaying in the dropdown. And yet, and yet...in the Command Window of
the IDE, I can query the contents of the ListItem and expose its
current values, for example "li.Value = 1" and "li.Text = Beverages."

Code Snip:

while (dr.Read())
{
ListItem li = new ListItem(dr.GetValue(0).ToString(),
dr.GetValue(1).ToString());
ddlCategory.Items.Add(li);
}
//dr.GetValue(0) is the CategoryID and dr.GetValue(1) is the
CategoryName

Thank you very much -

Jules

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Creating a dropdown list within a column dsebiz Microsoft Excel Misc 4 19th Mar 2008 05:56 PM
Dropdown List - list item endings not visible if column too narrow =?Utf-8?B?QUs5OTU1?= Microsoft Excel Misc 2 27th Apr 2007 09:02 AM
Dropdown List box in a template column..... Kim Microsoft ASP .NET 3 9th Mar 2004 03:07 PM
Picking value from dropdown list column Lee Microsoft Access Form Coding 0 18th Sep 2003 07:08 PM
Re: Picking value from dropdown list column Rick Brandt Microsoft Access Form Coding 1 18th Sep 2003 07:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:33 PM.