alternate view for a drop down list

R

RALF

I have a drop down list that I have populated with values such as
customer names. This is what shows up in the textbox part of the drop
down list. When I hit the arrow for the drop down, I want each row
that drops down to have additional info appended to the customer name.
Something like,

John Doe MS Corporation
Sally Doe ORCL Corporation
Bill Doe NT Corporation

Is this possible??

When the list is pulled down, I would like the text value shown for
each item along with their place of business, which is a field in the
same datasource
 
M

Mike Robbins

Hi, Ralf.

Can you modify the output of your datasource to concatenate the name and
company columns? Something like:

SELECT CustomerID, FirstName + ' ' + LastName + ' ' + Company AS ListText
FROM Customers

Then:

ddlCustomers.DataTextField = "ListText";
ddlCustomers.DataValueField = "CustomerID";

If you can't modify the SQL for some reason, then you can loop through the
DataReader and concatenate the colums there before adding them to the drop
down list's items collection.

HTH,

Mike
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top