Home All Groups Group Topic Archive Search About

Combining 2 Fields Using ListBox.DataTextField

Author
9 Nov 2005 11:08 PM
Nathan Sokalski
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
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
9 Nov 2005 11:40 PM
Darren Kopp
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
http://blog.secudocs.com/

Show quote
"Nathan Sokalski" <njsokal***@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
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
Author
10 Nov 2005 12:01 AM
Darren Kopp
oops, string.Format.

-Darren

Show quote
"Darren Kopp" <darrenkopp+newsgr***@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
> http://blog.secudocs.com/
>
> "Nathan Sokalski" <njsokal***@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
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>
>
Author
10 Nov 2005 8:49 AM
Patrick.O.Ige
Nathan you coould do that in SQL
Hope that helps
Patrick



Show quote
"Nathan Sokalski" <njsokal***@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
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
>

AddThis Social Bookmark Button