Repository navigation
Hyperlink Custom Action
Peter Gill edited this page Jun 8, 2026
·
16 revisions
dotnet add package Majorsilence.Reporting.RdlViewerSee Sample Hyperlink Custom Action example.
Works in the .NET viewer control.
You can pass information from your report, if viewed in the .NET control, back to your application. To do this select a field and change the action to hyperlink.



If you write your expression in a URI format you can use the .NET Uri class to easily read the data.
Code that handles the above screenshot hyperlinks.
using System.Windows.Forms;
using Majorsilence.Reporting.Rdl;
using Majorsilence.Reporting.RdlViewer;
class ReportForm : Form
{
private readonly RdlViewer _rdlView;
public ReportForm()
{
Height = 600;
Width = 800;
_rdlView = new RdlViewer();
// Subscribe to Hyperlink event
_rdlView.Hyperlink += ReportViewer_Hyperlink;
_rdlView.Dock = DockStyle.Fill;
Controls.Add(_rdlView);
Load += async (s, e) => await LoadReportAsync();
}
private async Task LoadReportAsync()
{
await _rdlView.SetSourceFile(new Uri(@"\path\to\your\report.rdl"));
await _rdlView.Rebuild();
}
private static void ReportViewer_Hyperlink(object sender, HyperlinkEventArgs e)
{
Uri uri = new Uri(e.Hyperlink);
// Look for "lastname:" set in hyperlink expression.
if (uri.Scheme.ToLower() == "lastname")
{
// It is very important to set Cancel to true. If not it will attempt
// to launch the hyperlink.
e.Cancel = true;
// do whatever you want with uri
}
}
}
class Program
{
[STAThread]
static void Main()
{
// One time per app instance
RdlEngineConfig.RdlEngineConfigInit();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ReportForm());
}
}using System.Windows.Forms;
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();
// Subscribe to Hyperlink event
rdlView.Hyperlink += rdlViewer1_Hyperlink;
rdlView.SourceFile = new Uri(@"\path\to\your\report.rdl");
rdlView.Rebuild();
rdlView.Dock = DockStyle.Fill;
frm.Controls.Add(rdlView);
Application.Run(frm);
}
private static void reportViewer_Hyperlink(object sender, fyiReporting.RdlViewer.HyperlinkEventArgs e)
{
Uri uri = new Uri(e.Hyperlink);
if (uri.Scheme.ToLower() == "lastname")
{
e.Cancel = true;
// do whatever you want with uri
}
}
}