Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ReportViewer Layout and custom datasource problem

Posted on 2010-09-21
4
Medium Priority
?
985 Views
Last Modified: 2012-06-27
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!
0
Comment
Question by:KurgerBurger
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:ina_don
ID: 33730880
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.
0
 

Author Comment

by:KurgerBurger
ID: 33731100
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.

0
 
LVL 5

Expert Comment

by:ina_don
ID: 33731195
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)
0
 

Accepted Solution

by:
KurgerBurger earned 0 total points
ID: 33743985
I have finally figured this out by up converting an existing sample report from 2008 to 2010 then carefully matching all the settings.  The documentation for ReportViewer is awful!  The problem lay with how parameters between the main report and subreport were defined.

Please close this thread.  Thanks!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question