How do I use a concatenation of 2 columns in a SQL DB in ASP.NET properly?

Posted by user293357 on Stack Overflow See other posts from Stack Overflow or by user293357
Published on 2010-05-28T12:56:06Z Indexed on 2010/05/28 13:01 UTC
Read the original article Hit count: 155

Filed under:
|
|

I'm using LinqToSql like this with a CheckBoxList in ASP.NET:

var teachers = from x in dc.teachers select x;
cbl.DataSource = teachers;
cbl.DataTextField = "name";
cbl.DataValueField = "teacherID";
cbl.DataBind();

I want to display both "firstname" and "name" in the DataTextField however. I found this solution but I'm using LINQ: http://stackoverflow.com/questions/839223/concatenate-two-fields-in-a-dropdown

How do I do this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql