|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Combining 2 Fields Using ListBox.DataTextFieldI 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. 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/ > 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/ >> > > 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/ > > |
|||||||||||||||||||||||