Solved

ReportViewer Layout and custom datasource problem

Posted on 2010-09-21
4
975 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

919 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

21 Experts available now in Live!

Get 1:1 Help Now