【问题标题】:Binding column fieldname to referenced object, DevExpress将列字段名绑定到引用的对象,DevExpress
【发布时间】:2013-12-07 04:28:15
【问题描述】:

我有两个班级:

public partial class EMPLOYER
{

    public int id { get; set; }
    public string name { get; set; }
    public string surname { get; set; }
    public int employer_func_id { get; set; }

    public virtual EMPLOYER_FUNC EMPLOYER_FUNC { get; set; }
}

public partial class EMPLOYER_FUNC
{
    public EMPLOYER_FUNC()
    {
        this.EMPLOYER = new HashSet<EMPLOYER>();
    }

    public int id { get; set; }
    public string func_name { get; set; }

    public virtual ICollection<EMPLOYER> EMPLOYER { get; set; }
}

例如,这是我的模型。现在我写sql查询。此查询返回 EMPLOYER 对象的列表。在视图中,我有 gridcontrol,其中有列名、姓氏和 func_name。显示姓名和姓氏很简单,没有问题,但我无法显示func_name。我尝试在网格控件中将 EMPLOYER_FUNC.func_name 输入到字段名称列但不起作用..你知道我该怎么做吗?非常感谢

【问题讨论】:

标签: c# sql devexpress gridcontrol


【解决方案1】:

为什么不在 EMPLOYER 类上创建另一个属性?

public string employer_func_name
{
    get { return EMPLOYER_FUNC.func_name; }
}

如果我正确理解了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-06
    • 1970-01-01
    • 1970-01-01
    • 2016-12-05
    相关资源
    最近更新 更多