winforms reporting - bind datatable

0 Answers 80 Views
Report Viewer - WinForms
arbam
Top achievements
Rank 1
Iron
arbam asked on 12 Sep 2022, 11:46 AM
I will send the data table to the local report file and print it out in the form of a table.
I tried to send only Parameters using UriReportSource, but I don't know how to send dataTable.
And I don't know how to show it in the form of a table in the trdp file.
You must send data to a report file in a specific folder and print it out, not through the server.
Neli
Telerik team
commented on 15 Sep 2022, 10:09 AM

Hi Konyang,

When the report is a TRDP file, you may create a report instance with our ReportPackager class. Here is a sample code demonstrating the approach:

var report = null;

var reportPackager = new ReportPackager();
using (var sourceStream = System.IO.File.OpenRead("Report1.trdp"))
{
    report = (Report)reportPackager.UnpackageDocument(sourceStream);
}

report.DataSource = GetMyDataTable();

// Use the InstanceReportSource to pass the report to the viewer for displaying
var reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = report;

// Assigning the report to the report viewer.
reportViewer1.ReportSource = reportSource;

// Calling the RefreshReport method in case this is a WinForms or WPF application.
reportViewer1.RefreshReport();

I hope this will help. If you have further questions we will be glad to assist.

No answers yet. Maybe you can help?

Tags
Report Viewer - WinForms
Asked by
arbam
Top achievements
Rank 1
Iron
Share this question
or