views:

456

answers:

2

I have an report, in which I like to show reports about some Employees. The Employee Class contains the following attributes :

public class Employee{
                public string name;
                public Branch branch;
}

I have an list of employees, and I bind them to the report columns. It is showing employee name without any problem in the first column of the report table, but in the second column it is showing the Branch object's assembly, namespace etc etc. (It is obvious, of course, since I am binding the whole Branch object to that column).

My question is : how can I show employee name in one column and corresponding branch name in another column?

My Branch Class has the following definition :

 public class Branch{
                  public int branchId;
                  public string name;
 }

I am adding an data source to the report class from the tool box, creating an "XtraReport" object, and simply assigning an Employee list as follows :

XtraReport1.DataSource = EmployeeList;
+1  A: 

your binding probably looks like:

....DataBindings.Add(new Binding("Text", employee, "branch"));

change it to

....DataBindings.Add(new Binding("Text", employee.branch, "name"));
SnOrfus
+1  A: 

XtraReport objects can do sub-property binding. Give your label the text "[branch.name]" (rather than picking the data source with the designer drop-down).

Thomas G. Mayfield