-
Notifications
You must be signed in to change notification settings - Fork 201
Report Viewer Events
Peter Gill edited this page May 3, 2024
·
3 revisions
dotnet add package Majorsilence.Reporting.RdlViewer
For an overview of using the viewer see Winform Viewer.
If you have a report viewer you can subscribe to the CurrentPageChange event to be notified every time the event changes.
using System.Windows.Forms;
using fyiReporting;
using fyiReporting.RDL;
using fyiReporting.RdlViewer;
class Program
{
[STAThread]
static void Main()
{
System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
frm.Height = 600;
frm.Width = 800;
fyiReporting.RdlViewer.RdlViewer rdlView = new fyiReporting.RdlViewer.RdlViewer();
rdlView.SourceFile = new Uri(@"\path\to\your\report.rdl");
rdlView.Rebuild();
rdlView.Dock = DockStyle.Fill;
frm.Controls.Add(rdlView);
// Page Count Event
rdlView.PageNavigation += (object sender, fyiReporting.RdlViewer.PageNavigationEventArgs e1) =>
{
MessageBox.Show("Page Changed. Current page is: " + e1.NewPage);
};
Application.Run(frm);
}
}