How to bind nested class objects to DataGridView?
Hi all,
I have 2 classes like this:
namespace NHibernate.Examples.UserDeptModule
{
public class Dept
{
private Guid id;
private String deptName;
private String deptTel;
public virtual Guid Id
{
get { return id; }
set { id = value; }
}
public virtual String DeptName
{
get { return deptName; }
set { deptName = value; }
}
public virtual String DeptTel
{
get { return deptTel; }
set { deptTel = value; }
}
public override String ToString()
{
return deptName;
}
}
}
namespace NHibernate.Examples.UserDeptModule
{
public class User
{
private Guid id;
private Guid dept_id;
private Dept dept;
private string userName;
public User()
{
}
public virtual Guid Id
{
get { return id; }
set { id = value; }
}
public virtual Guid Dept_Id
{
get { return dept_id; }
set { dept_id = value; }
}
public virtual Dept DeptRef
{
get { return dept; }
set
{
if (value != null)
{
this.dept_id = value.Id;
}
dept = value;
}
}
public virtual string UserName
{
get { return userName; }
set { userName = value; }
}
}
}
My project is under NHibernate, and two class is done in many-to-one manner. Now I want to show user information to DataGridView including Dept's deptName and deptTel. How to do this?
Thank you very much.
--
Best regards,
Diviner.