views:

96

answers:

2

Hi , i want to know is it possible to bind my all crystal reports to a single reportviewer, somewhat in tabbed view or treevie. If tabbed then visible through navigation button.

If yes then how?

any help would be highly appreciated.

Amit Ranjan

+1  A: 

Could you not hold your reports in a hierarchical structure in memory , which relates to a visible tree view and displayed the relevant report one at a time as the users selects various nodes..

If you can't pass a colection of reports to your viewer. I would hold a list of reports in a Dictionary or some other kind of list , which has a report and an identifier for that report.

Then display a tree view which represents the reports structure you have, with each node holding the id of the report it represents, when the user selects the a TreeView node, you can look up you report from the dictionary and load it into the report viewer.

I hope that makes sense...

NoelAdy
sorry i did'nt get. Please be more specific.. did you mean physically heirarchically (folder/files)
Amit Ranjan
Now, I got u... but the same thing i want to know is it possible or not. The ways you suggested are already known to me. As reportviewer uses report source. So, i was wondering if i could bind it the way we bind gridview or datalists. Also i have only 13 flat reports , no hierarchies there. So all must be child of root node. so please clear, if i can display its as a node in tree and also view it.I hope , now i am more clear than earlier
Amit Ranjan
+1  A: 

Having reviewed the micrososft documentation, it seems you can not bind multiple reports to a viewer. As suggested here:

"Displaying a report using the CrystalReportViewer control The CrystalReportViewer control displays only one report at a time. Which report is displayed by the control is determined by which report you bind to your code. To tell the control which report to display, you bind the ReportSource property of the control to a particular report. At runtime, the control loads the report that is bound to the ReportSource property and displays it. "

The diocumentation goes on to say you can only bind a report type to the report source.

So, basically you need to build the multi view yourself. In my mind this can be done in two ways.

  • Create a report viewer for each report (maybe using a tab control)

  • Create a single viewer and display different reports based on what the user selects in your application. i.e.

I have done something simular in the past, but rather than using the report viewer, i used crystal to export the report to pdf and displayed those to the user.

I hope this is clearer. :-)

NoelAdy
thanks, i am doing the earlier one. since I have 13 reports only, i hardcoded the nodes as their names
Amit Ranjan