How to show the same RDLC on same ReportViewer mutltiple times with different dataset? RRS feed

  • Question

  • Hi. I read similar topics but I did not find a solution or maybe I just did not understand because im a beginner. I have function that querys some data into datatables and then gives RDLC file and tables to another function that opens ReportViewer window.

    This is the function that opens one RDLC file in a window that has formshost control:

    _reportViewer =

    new ReportViewer


    formsHost.Child = _reportViewer;

    public void OpenInWindow(string RDLCfile, List<DataTable> tables)



    if (tables == null)





    _reportViewer.ProcessingMode =


    _reportViewer.LocalReport.ReportPath = RDLCfile;


    foreach (DataTable t in tables)



    new ReportDataSource(t.TableName, t));


    Show(); //opens the window and shows one report


    I think you allready guess what I need now - I need to show the same RDLC file in the same window multiple times (bills for example) but with different datacontext (tables are same but different content).

    I know how to show each in a different window but I need to show all in the same window. Please advice...

    Thursday, March 31, 2011 1:44 PM

All replies

  • I'm not sure exactly how you want this to work. But if you want to be able to reuse the same viewer with a different report, then doe something like this;


    Basically rewire the datasources and cause the report and viewer to refresh with the new information.


    Thursday, March 31, 2011 5:11 PM
  • but will I be able to see the old information? I tried but I only saw the last report on the list. Instead of ReportViewer I need ReportsViewer :) I need to see the whole list of reports

    • Edited by GaiusBaltar Friday, April 1, 2011 7:18 AM typo
    Friday, April 1, 2011 6:26 AM
  • No solution to my problem? Its hard to beleave, all I need is to see multiple reporst and the same time. I know how to do buttons that can switch beteen reports but thats not what I need. I need to see them and the same time...

    Monday, April 4, 2011 8:36 AM
  • im not sure if this is what you mean, but you should take the old datatable and the new datatable and make one datatable from both of them, with some key column that will allow you to enter some Identification between the two datatables.

    on the report itself, the RDLC file,  you should put the entire content of the report into a List component and have the grouping for that List to be set on the key column, and mark the "allow page break between instances" check box on the List.

    that way you will have each "datatable" be presented in a different page of a report. and you can see old data with new data.

    hope that helps.

    Monday, April 4, 2011 12:41 PM
  • Thats makeing a new report file. Then I have to make remake dozns of reports :(
    Monday, April 4, 2011 1:45 PM