alternate view for a drop down list

Discussion in 'ASP .Net Web Controls' started by RALF, Oct 20, 2005.

  1. RALF

    RALF Guest

    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
     
    RALF, Oct 20, 2005
    #1
    1. Advertising

  2. RALF

    Mike Robbins Guest

    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

    "RALF" wrote:

    > 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
    >
    >
     
    Mike Robbins, Oct 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    826
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,080
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    554
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    321
  5. Replies:
    3
    Views:
    325
Loading...

Share This Page