Solved

ReportViewer Layout and custom datasource problem

Posted on 2010-09-21
4
974 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now