I have a first name and a surname as separate columns in a table. If I bind a combo box to a query and set DisplayMember property to "Name" then each person a table is represented in a combo box by its name. How do I show each person's full name (built from concatenating 2 columns) in a single comb box item in this case?
views:
35answers:
1
+2
A:
(I'm not sure if this works in winforms, but I'm using this a lot in in ASP.NET):
Add a new property to your entity class, which is used for databinding (concatenates the other properties), e.g:
public string DisplayName
{
get { return this.FirstName + " " + this.LastName; }
}
M4N
2010-05-08 12:03:02