Binding column fieldname to referenced object, DevExpress

805 views Asked by At

I have two classes:

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; }
}

and

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; }
}

for example it is my model. Now I write sql query. This query returns a list of EMPLOYER objects. In View I have gridcontrol where I have columns name, surname and func_name. Display name and surname are simple and it is not problem, but I can't display func_name. I try type EMPLOYER_FUNC.func_name to field name column in grid control but not work.. Do you know how can I do it? thanks a lot

1

There are 1 answers

0
Tom On

Why not just create another property on the EMPLOYER class?

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

That's if I understood the question correctly.