TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Samio
NA
201
176.7k
LINQ to Entities - how to get column value in a combobox selection
Mar 30 2012 2:09 PM
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
";
}
Reply
Answers (
4
)
Initialize Combo box with a blank item - LINQ C#
Locks, latches, enqueues and semaphores