Reporting not showing within ReportViewer Control when configured via C# code-behind

1 Answer 26 Views
Report Viewer - WPF
Tommy
Top achievements
Rank 1
Iron
Tommy asked on 07 Nov 2023, 01:18 AM

Hello All!  I am having some difficulties debugging an issue with the ReportViewer not showing the rendered Report.  The Output states that the report was rendered in X seconds.  My report xaml is as follows:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tr="http://schemas.telerik.com/wpf" x:Class="FRAC_FLOW.TestReport"
    Title="Report Viewer Window">

    <Grid x:Name="LayoutRoot">
        <Grid Margin="20" >
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <tr:ReportViewer Grid.Row="0" x:Name="ReportViewer1"/>
        </Grid>
    </Grid>
</Window>

I am setting the source and parameters in the constructor:

public TestReport()
{
    InitializeComponent();


    Telerik.Reporting.Parameter parm = new Telerik.Reporting.Parameter { Name = "JobId", Value = "7215" };
    Telerik.Reporting.Parameter parm1 = new Telerik.Reporting.Parameter { Name = "Date", Value = DateTime.Now.ToShortDateString() };

    var reportSource = new UriReportSource();
    reportSource.Uri = new Uri("Reports/ReplacementParts.trdp", UriKind.RelativeOrAbsolute).ToString();

    ReportViewer1.ReportSource = reportSource;
    ReportViewer1.ReportSource.Parameters.Add(parm);
    ReportViewer1.ReportSource.Parameters.Add(parm1);
    ReportViewer1.RefreshReport();
}
When I call this code from a button, I just do the Window.Show() method I saw in the examples.  The Window and Viewer seem to popup just fine, however, I am not seeing the report.  I have reviewed the report in the Report Designer, and I don't see anything that would cause it not to open.  In fact, I can Preview the report just fine, and the data looks good.  Any help is highly appreciated, as I've been stuck on this for a day now, and I've never reached out for help on here!  Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 09 Nov 2023, 01:18 PM

Hello Tommy,

Your code looks correct and the fact that you see a message stating the time it took to render the report, supports this.

What you experienced looks more like a styling issue to me so I would suggest making sure that the viewer component is styled using implicit styles.

See Setting the Theme of WPF Report Viewer for more information.

Additionally, please verify that the required assemblies have the version that corresponds to your Reporting version (see Upgrade articles).

You can examine the WPF integration demos we distribute with the Telerik Reporting installation, for reference. By default, the examples can be found in: 

C:\Program Files (x86)\Progress\Telerik Reporting <VERSION>\Examples\CSharp

I hope this helps.

Best Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
Report Viewer - WPF
Asked by
Tommy
Top achievements
Rank 1
Iron
Answers by
Momchil
Telerik team
Share this question
or