This is a migrated thread and some comments may be shown as answers.

Problem with objectDataSource and SubReport

1 Answer 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 30 Mar 2012, 10:05 AM
Hi there,

I get all my data for the reports out of objects and no SQL!
All the objects do have methodes that do return lists of themself (statics) or lists of other ("linked" to this instsance) objects.

simple example:

	class Company
	{
		public string companyname { getset; }
 
		public static List<Company> GetAll()
		{
			List<Company> allCustomers = new List<Company>();
			Company customer = new Company();
			customer.companyname = "Smith & Sons";
			allCustomers.Add(customer);
 
			customer = new Company();
			customer.companyname = "Miller Corp.";
			allCustomers.Add(customer);
 
			customer = new Company();
			customer.companyname = "Clarksons";
			allCustomers.Add(customer);
 
			return allCustomers;
		}
 
 
		public List<Employee> getEmployees()
		{
			List<Employee> employees = new List<Employee>();
			Employee person = new Employee();
			person.name = "Mr." + this.companyname;
			employees.Add(person);
			
			person = new Employee();
			person.name = "Father of " + this.companyname;
			employees.Add(person);
 
			return employees;
		}
	}


So I created two reports (company + employee) and put the second as a subreport into the first.
The main report has as a datasource "Company.getAll" and the subreport "Company.getEmployees".
Now the problem: vor every parent object the method getEmployee" is called (in this example 3 times), but the instance of company is always EMPTY!? not null - all the properties are just blank)
Please have a look at the output attached. There I expected to read "Mr. Smith & Sons", "Father of Smith & Sons", "Mr. Miller Corp." and so on...

Is there a way how I can get the real instance of the parent object into the subreport?

Thanks in advance :-)


1 Answer, 1 is accepted

Sort by
0
David Silveria
Top achievements
Rank 1
answered on 02 Apr 2012, 04:51 PM
Sebastian, check the following forum post for explanation and sample that you can review: http://www.telerik.com/community/forums/reporting/telerik-reporting/hierarchical-data-dictionary-and-list.aspx#2041863
Tags
General Discussions
Asked by
Sebastian
Top achievements
Rank 1
Answers by
David Silveria
Top achievements
Rank 1
Share this question
or