How to bind virtual member to DataGridView in C# & Entity Framework
<p>I have these classes for products and Units</p>

<pre><code>public class Product
{
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public int UnitId { get; set; }
        public virtual Unit Unit { get; set; }
}

public class Unit
{
        public int UnitId { get; set; }
        public string UnitName{ get; set; }
}
</code></pre>

<p>I want to bind a list of these entities to a <code>DataGridView</code> dynamically. And I did it successfully but I am facing problem in displaying the name of the unit. </p>

<p>I tried this code for that, but no luck!</p>

<pre><code>var F1 = new DataGridViewTextBoxColumn();
F1.HeaderText = "Unit";
F1.DataPropertyName = "Unit=&gt;UnitName";
dataGridView1.Columns.Add(F1);
</code></pre>

<p>and </p>

<pre><code>var F1 = new DataGridViewTextBoxColumn();
F1.HeaderText = "Unit";
F1.DataPropertyName = "Unit.UnitName";
dataGridView1.Columns.Add(F1);
</code></pre>

<p>Please help!</p>