LINQ to Entities - how to get column value in a combobox selection
As displaying LastName in comboBox1, I need to display FirstName in TextBox1.
How can I do that in LINQ ?
My code is as follows
using (LINQtoEntitiesEntities MyEntities = new LINQtoEntitiesEntities())
{
ObjectQuery<Employee> Emp = MyEntities.Employee;
comboBox1.DataSource = (from u in Emp select new { u.ID, u.LastName, u.FirstName }).ToList();
comboBox1.ValueMember = "ID";
comboBox1.DisplayMember = "LastName";
}