ComponentOne.TrueDBGrid binding

597 Views Asked by At

1 I am using ComponentOne.TrueDBGrid;

2 I am using UserList as the datasource;

3 I need filterbar and sortings for this grid ;

some important code like below: public class User{ public int UserID{get;set;} public string UserName{get;set;} public Company TheCompany{get;set;} }

public class Company{ public override ToString(){ return CompanyName; } public string CompanyName{get;set;} }

List UserList

Question:

1 How can I bind UserList to the TrueDBGrid to show these Columns ?

|UserID|UserName|CompanyName| I think these datafields should be UserID , UserName, TheCompany.CompanyName,But I can't see the CompanyName is empty;

2 I need change Company in this grid , so I need I add valueItems for CompanyName

   I think these datafields should be UserID , UserName, TheCompany,and override Company.ToString() = CompanyName 
   But I can't sorting the companyName column and can't change company because the datatype is string can't covert to Company;

Is these a good way to resolve these problems ?

1

There are 1 best solutions below

0
On

A bit late, but...

Add a readonly string property to UserList that returns TheCompany.CompanyName.