Using Entities classes with DataGridView
Posted: Thu 12 Mar 2009 00:54
It is very easy to display and edit a database table represented by Entity class in DataGridView:
But when one of the columns is an FK to another table (like Department) the DataGrid would display the whole Entity Department in that column. As a result it does not show anything. I am interested in the FK value (DepartmentID) which is still a part of Employee table. Is it possible to tell the DataGrid to display the DepartmentID instead of the whole Department?
Thanks
Code: Select all
var context = new Entities();
dataGridView1.DataSource = context.EMPLOYEE;
Thanks