Solved

ReportViewer Layout and custom datasource problem

Posted on 2010-09-21
4
978 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.net/VSTO Excel Add-in 2 39
Cannot interpret token '"' at position 10. 3 25
Open telerik datetime picker programmatically 13 42
Easiest intro into .NET CORE? 2 34
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…
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…

710 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