Combining 2 Fields Using ListBox.DataTextField

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Combining 2 Fields Using ListBox.DataTextField

    I have a ListBox control which I am using with databinding. However, the
    text that I want to be displayed is a combination of two fields (in this
    case, first and last names). What do I enter as the DataTextField property
    to combine these two fields? Thanks.
    --
    Nathan Sokalski
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. How to: Populate listbox with fields from DB
      I created a .cfm page using various queries to output a company phone list (1. lname alpha, 2. dept, 3. branch). I then have it create a .PDF using...
    2. combining 2 datasource fields into hyperlink column
      Hello, Does someone have sample code to combine a title field and a hyperlink field to a datagrid column? For example: A link to google would...
    3. newbie question: combining fields
      Thanks ya much! :-) "Ian.H " <ian@WINDOZEdigiserv.net> wrote in message news:20030831232735.63402517.ian@WINDOZEdigiserv.net... <Cool stuff...
    4. now desparate! - 1st listbox contents disappears when 2nd listbox appears?
      On 23 Jun 2003 12:57:45 -0700, KathyBurke40@attbi.com (KathyB) wrote: Its been a while since you posted but I will answer anyway. The problem...
    5. Combining Fields
      Look up 'ISNULL' and COALESCE' in BOL. "Greg" <gmanship@wvmls.com> a écrit dans le message de news: us3E67MQDHA.3192@tk2msftngp13.phx.gbl...
  3. #2

    Default Re: Combining 2 Fields Using ListBox.DataTextField

    Well, for a general purpose answer... this should work.

    list.DataTextField = string.Forma("{0}, {1}", FirstNameVar, LastNameVar);

    FirstNameVar and LastNameVar are string variables or you could use really
    anything, I'm sure you get the basic idea.


    HTH
    -Darren Kopp
    [url]http://blog.secudocs.com/[/url]

    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    news:eiUZ5JY5FHA.3908@tk2msftngp13.phx.gbl...
    >I have a ListBox control which I am using with databinding. However, the
    >text that I want to be displayed is a combination of two fields (in this
    >case, first and last names). What do I enter as the DataTextField property
    >to combine these two fields? Thanks.
    > --
    > Nathan Sokalski
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >

    Darren Kopp Guest

  4. #3

    Default Re: Combining 2 Fields Using ListBox.DataTextField

    oops, string.Format.

    -Darren

    "Darren Kopp" <darrenkopp+newsgroup@gmail.com> wrote in message
    news:ORTtybY5FHA.3976@TK2MSFTNGP15.phx.gbl...
    > Well, for a general purpose answer... this should work.
    >
    > list.DataTextField = string.Forma("{0}, {1}", FirstNameVar, LastNameVar);
    >
    > FirstNameVar and LastNameVar are string variables or you could use really
    > anything, I'm sure you get the basic idea.
    >
    >
    > HTH
    > -Darren Kopp
    > [url]http://blog.secudocs.com/[/url]
    >
    > "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    > news:eiUZ5JY5FHA.3908@tk2msftngp13.phx.gbl...
    >>I have a ListBox control which I am using with databinding. However, the
    >>text that I want to be displayed is a combination of two fields (in this
    >>case, first and last names). What do I enter as the DataTextField property
    >>to combine these two fields? Thanks.
    >> --
    >> Nathan Sokalski
    >> [email]njsokalski@hotmail.com[/email]
    >> [url]http://www.nathansokalski.com/[/url]
    >>
    >
    >

    Darren Kopp Guest

  5. #4

    Default Re: Combining 2 Fields Using ListBox.DataTextField

    Nathan you coould do that in SQL
    Hope that helps
    Patrick



    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    news:eiUZ5JY5FHA.3908@tk2msftngp13.phx.gbl...
    > I have a ListBox control which I am using with databinding. However, the
    > text that I want to be displayed is a combination of two fields (in this
    > case, first and last names). What do I enter as the DataTextField property
    > to combine these two fields? Thanks.
    > --
    > Nathan Sokalski
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >
    >

    Patrick.O.Ige 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