locked
Displaying same RDLC multiple times in a report viewer RRS feed

  • Question

  • Hi ,

    Requirement:

    I have a dataset with following data:

     

    Question Id Opt1 Opt2 Opt3 Opt4
    Q1 1 3 0 2
    Q2 0 1 4 2

     

    I have a rdlc report that will show bar graph based on data..

    My requirement is to display the same RDLC in report viewer for the number of rows I have in the dataset.

    So 1st graph should display data of row 1, 2nd graph (smae rdlc) to be displayed in same report viewer with data of row 2.

    This is the report viewer markup :

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="920px" 
           Font-Names="Verdana" Font-Size="8pt" Height="400px" Visible="False" > 
           
     </rsweb:ReportViewer>
    

    Following is the code I have written to add reports to report viewer:

     

     ReportViewer1.Reset();
          ReportViewer1.LocalReport.DataSources.Clear();
    
          ReportDataSource RDS1 = new ReportDataSource();
          RDS1.Name = "Varun1DataSet_tblData";
          RDS1.Value = new Varun1DataSetTableAdapters.tblDataTableAdapter().GetData("Q1");
    
          ReportViewer1.LocalReport.DataSources.Add(RDS1);
          ReportViewer1.LocalReport.ReportEmbeddedResource = "WebApplication3.Report1.rdlc";
    
    
          ReportDataSource RDS2 = new ReportDataSource();
          RDS2.Name = "Varun1DataSet_tblData";
          RDS2.Value = new Varun1DataSetTableAdapters.tblDataTableAdapter().GetData("Q2");
    
          ReportViewer1.LocalReport.DataSources.Add(RDS2);
          ReportViewer1.LocalReport.ReportEmbeddedResource = "WebApplication3.Report1.rdlc";
          
          ReportViewer1.DataBind();
          ReportViewer1.LocalReport.Refresh();
    

    When running the report, It is showing the 1st report only and not the 2nd one.

    What should I do to display the 2nd report as well?

    Thanks

    Varun


    Varun Sharma
    Monday, March 7, 2011 6:15 AM

Answers

  • Please try placing your chart inside the detail row of the table control. When done so each chart will get data within the scope (in this case the data for the current row).

     

     


    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

    BH

    • Marked as answer by Varun_Sharma Monday, March 7, 2011 11:32 AM
    Monday, March 7, 2011 9:46 AM

All replies

  • Please try placing your chart inside the detail row of the table control. When done so each chart will get data within the scope (in this case the data for the current row).

     

     


    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

    BH

    • Marked as answer by Varun_Sharma Monday, March 7, 2011 11:32 AM
    Monday, March 7, 2011 9:46 AM
  • Hi Bilal,

    Thanks a lot.. It worked. I tried putting the graph in the detail row of the table but it gave an error stating that can not put graph in that region of the table.

    Then I placed the chart list control in the detail section and then tried putting the graph there, it allowed.

    After that the graph gets repeated for each row in the dataset.

    Thank you very much once again..

     

    Regards

    Varun


    Varun Sharma
    Monday, March 7, 2011 11:32 AM
  • Hi Varun

    Glad to note that it helped you and you figured out the issue as well. If convenient for you, may I know the error message you got when placed in detail section and what you meant by "chart list control". I am using SSRS BIDS environment and just want to figure out any potential differences between BIDS AND report designer within visual studio.

    Thanks

     


    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

    BH

    Monday, March 7, 2011 12:20 PM