DataGridView显示导航属性的值
宏翔软件技术文章2021/11/1 12:13:14
private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
#region 导航属性显示
if (e.RowIndex >= 0 && e.ColumnIndex == 1)
{
var orderLineItem = (RawMaterial)(this.dgv.Rows[e.RowIndex].DataBoundItem);
if (orderLineItem.FK_Table_Classification != null)
e.Value = orderLineItem.FK_Table_Classification.Name;
}
#endregion
}