KurgerBurger
asked on
ReportViewer Layout and custom datasource problem
Ok I'll admit this is the first time I've tinkered with ReportViewer, I'm using VS2010. My data is in the form of a List of Order objects, each contains info such as buyer's name, address, date, etc. and a List of OrderDetail objects. Pretty straightforward.
First problem is I want to display a single Order with a subreport containing the OrderDetails. If I drag fields from the Order onto the Report Designer the first and only first object in my list displays. The back, next controls are disable.
However if I put all the field into a List on the Report Designer surface, each object in my List<Order> gets displayed all at once on the ReportViewer form. How do I instruct the Viewer to display a single entity at a time?
2nd problem. VS2010 ReportViewer has a problem in that it cannot drill down into nested objects, so I have flattened my objects. Each time the viewer displays an object from my list, I want to be able to build a list to set to the bindingsource for the subreport. But it seems RV wants a complete list of OrderDetails and set a filter. I've read that it can be done manually, how?
Thanks!
First problem is I want to display a single Order with a subreport containing the OrderDetails. If I drag fields from the Order onto the Report Designer the first and only first object in my list displays. The back, next controls are disable.
However if I put all the field into a List on the Report Designer surface, each object in my List<Order> gets displayed all at once on the ReportViewer form. How do I instruct the Viewer to display a single entity at a time?
2nd problem. VS2010 ReportViewer has a problem in that it cannot drill down into nested objects, so I have flattened my objects. Each time the viewer displays an object from my list, I want to be able to build a list to set to the bindingsource for the subreport. But it seems RV wants a complete list of OrderDetails and set a filter. I've read that it can be done manually, how?
Thanks!
I'm not sure if you need to add a subreport for what you're trying to do. You could easily do this by properly querying the database. You could run a single query that will return all the information that you need and then use grouping in the report so that all records bearing the same order number appear on a single page. Subreports are not that glamourous and may not be necessary in this case.
ASKER
Well the whole app is designed around Linq/SQL and the data layers are segregated away from the business and presentation layers so I'd like to avoid doing some sort of data mangling just for the report.
Try looking at these
http://msdn.microsoft.com/en-US/library/ms251700%28v=VS.80%29.aspx
http://northwind.codeplex.com/ (sample application with reports that do exactly what you're trying to do except not with linq but I suspect the techniques should be similar)
http://msdn.microsoft.com/en-US/library/ms251700%28v=VS.80%29.aspx
http://northwind.codeplex.com/ (sample application with reports that do exactly what you're trying to do except not with linq but I suspect the techniques should be similar)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.