none
C#/WPF - Report viewer shows a blank page RRS feed

  • Question

  • Hi everybody,

    I'm a beginner with Report Viewer in C#. I created a RDC file from the application Report Builder for SQL Server 2008 R2. The datasets are embedded into the file and I'm able to show the report without issue.

    I tried to integrate this report in a WPF application. Here is a part of my code :

    WPF window used to show the report :

        <Grid>
            <WindowsFormsHost>
                <rv:ReportViewer x:Name="rpvwMain"/>
            </WindowsFormsHost>
        </Grid>

    C# constructor of the WPF window used to show the report :

            public Report(string filepath, List<ReportParameter> parameters)
            {
                PathFile = filepath;
                Parameters = parameters;
                InitializeComponent();
    
                rpvwMain.LocalReport.ReportPath = PathFile;
                rpvwMain.ProcessingMode = ProcessingMode.Local;
                rpvwMain.LocalReport.SetParameters(Parameters);
                rpvwMain.LocalReport.Refresh();
                rpvwMain.Refresh();
                rpvwMain.Show();
            }
    

    C# code used to call the WPF window and show the report :

                    var pm = new List<Microsoft.Reporting.WinForms.ReportParameter>();
                    pm.Add(new Microsoft.Reporting.WinForms.ReportParameter("id_user", a.id_account.ToString(), false));
                    var wr = new Windows.Report(@"C:\MyFolder\MyReport.rpt", pm);
                    wr.Show();
    

    If I try to show the window, a blank page is showed without data or any error message.

    Does C# report viewer support RDL files ?

    How can I show my report ?

    I would like (if possible) keep my dataset in my report and not create them in the application.

    Thanks in advance for your help.

    • Moved by Caillen Monday, May 26, 2014 7:43 AM
    Sunday, May 25, 2014 3:08 PM

All replies