dropdownlist-concat two fields-can it be done

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default dropdownlist-concat two fields-can it be done

    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 Guest

  2. Similar Questions and Discussions

    1. Concat two fields in SQL
      I am trying to concatenate two columns in an SQL statement but haven't been having much success: here is the portion of the SQL: ...
    2. Concat problem with SQL
      hi all I have a problem when I try to concat 2 fields with a dot, in a query (Oracle database). here an example : <query name="myquery"...
    3. concat fields then search the new field
      how would I concatenate several fields from a record set then search the new field for individual keywords ? something like: Dim theArray ...
    4. php string concat
      Hello, Simple question here.... I am trying to concatenate 2 strings but it doesn't seem to work. My only experience in in C and VB 6.0. ...
    5. HOW CAN I CONCAT TWO LINEAR LISTS
      I have two linear lists: temp1 = temp1 = I want to combine them into one list i.e result =
  3. #2

    Default Re: dropdownlist-concat two fields-can it be done

    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:
    >[url]www.aboutfortunate.com[/url]
    >
    >"Out of chaos comes order."
    > Nietzche
    >"ctb" <clark@speakeasyinteractive.com> wrote in message
    >news:089e01c34d42$b57463f0$a001280a@phx.gbl...
    >> 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 Guest

  4. #3

    Default Re: dropdownlist-concat two fields-can it be done

    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:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "ctb" <clark@speakeasyinteractive.com> wrote in message
    news:090201c34d47$c0ef7080$a001280a@phx.gbl...
    > 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:
    > >[url]www.aboutfortunate.com[/url]
    > >
    > >"Out of chaos comes order."
    > > Nietzche
    > >"ctb" <clark@speakeasyinteractive.com> wrote in message
    > >news:089e01c34d42$b57463f0$a001280a@phx.gbl...
    > >> 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139