dropdownlist-concat two fields-can it be done

Discussion in 'ASP .Net' started by ctb, Jul 18, 2003.

  1. ctb

    ctb Guest

    I am not sure how to, or even if you can do this. I have
    tried several things.
    I have a drop down list that is databound to a
    datareader. I wish to set the DataTextField to a
    concatentation of first and last name that are stored in
    the database.

    any idea if there is a way to do this?
    Thanks
     
    ctb, Jul 18, 2003
    #1
    1. Advertising

  2. ctb

    ctb Guest

    I will try this, especially the first option
    but, one more question
    I also bind the datafieldvalue to the Member_id in the
    drop down list.
    In my select statement can I select another field
    (member_id) in addition to the concatenated fields in the
    AS clause.



    >-----Original Message-----
    >There are two approaches to this:
    >
    >1) Concatenate the fields in your select statement from

    the database "SELECT
    >(lastName + ', ' + firstName) AS fullName From tblNames
    >
    >2) You could concatenate the fields in the drop down's

    OnItemDataBound
    >event.
    >
    >The first way is probably the more efficient one.
    >
    >I hope this helps.
    >
    >--
    >S. Justin Gengo, MCP
    >Web Developer
    >
    >Free code library at:
    >www.aboutfortunate.com
    >
    >"Out of chaos comes order."
    > Nietzche
    >"ctb" <> wrote in message
    >news:089e01c34d42$b57463f0$...
    >> I am not sure how to, or even if you can do this. I

    have
    >> tried several things.
    >> I have a drop down list that is databound to a
    >> datareader. I wish to set the DataTextField to a
    >> concatentation of first and last name that are stored in
    >> the database.
    >>
    >> any idea if there is a way to do this?
    >> Thanks

    >
    >
    >.
    >
     
    ctb, Jul 18, 2003
    #2
    1. Advertising

  3. Yes, you can select as many fields as you want!

    SELECT Member_id, (lastName + ', ' + firstName) AS fullName From tblNames




    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche
    "ctb" <> wrote in message
    news:090201c34d47$c0ef7080$...
    > I will try this, especially the first option
    > but, one more question
    > I also bind the datafieldvalue to the Member_id in the
    > drop down list.
    > In my select statement can I select another field
    > (member_id) in addition to the concatenated fields in the
    > AS clause.
    >
    >
    >
    > >-----Original Message-----
    > >There are two approaches to this:
    > >
    > >1) Concatenate the fields in your select statement from

    > the database "SELECT
    > >(lastName + ', ' + firstName) AS fullName From tblNames
    > >
    > >2) You could concatenate the fields in the drop down's

    > OnItemDataBound
    > >event.
    > >
    > >The first way is probably the more efficient one.
    > >
    > >I hope this helps.
    > >
    > >--
    > >S. Justin Gengo, MCP
    > >Web Developer
    > >
    > >Free code library at:
    > >www.aboutfortunate.com
    > >
    > >"Out of chaos comes order."
    > > Nietzche
    > >"ctb" <> wrote in message
    > >news:089e01c34d42$b57463f0$...
    > >> I am not sure how to, or even if you can do this. I

    > have
    > >> tried several things.
    > >> I have a drop down list that is databound to a
    > >> datareader. I wish to set the DataTextField to a
    > >> concatentation of first and last name that are stored in
    > >> the database.
    > >>
    > >> any idea if there is a way to do this?
    > >> Thanks

    > >
    > >
    > >.
    > >
     
    S. Justin Gengo, Jul 18, 2003
    #3
    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. GG
    Replies:
    3
    Views:
    5,588
    mail2saion
    May 14, 2009
  2. Peña, Botp
    Replies:
    2
    Views:
    190
    Peña, Botp
    May 31, 2007
  3. Zhidian Du
    Replies:
    0
    Views:
    178
    Zhidian Du
    Feb 21, 2004
  4. Replies:
    6
    Views:
    151
    Anno Siegel
    Jul 11, 2005
  5. AMT2K5
    Replies:
    1
    Views:
    214
    Eric Schwartz
    Nov 8, 2005
Loading...

Share This Page