)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to handle hyperlink events in application

Platform: WPF |
Control: ReportViewer |
Published Date: January 11, 2018 |
Last Revised Date: May 23, 2019

Hyperlink event allows to perform the customized action in your application when hyperlink is clicked in a report. The following section describes the details to add hyperlink to report and handle the customized action in application.

Adding a Hyperlink action

You can add a hyperlink to report items in RDL/RDLC reports with the help of Action properties. The below steps guide you to do this with the help of WPF Syncfusion Report Designer.

  • In design view of report, right-click the report items, then click Properties.

Right click the report item and select properties

  • In the properties dialog, select Action tab and choose Go to URL options.

Select Action tab and choose Go to URL

Specify the URL

  • Click OK.

Handling event in application

The hyperlink event can be registered in XAML or code behind as like following code snippet,

XAML 

<Grid>
        <sync:ReportViewer x:Name="Viewer" ReportPath="../../Resources/GroupingAgg.rdl" ProcessingMode="Remote" Hyperlink="Hyperlink_clicked"/>
 </Grid>

 

C#

Viewer.Hyperlink += new HyperlinkEventHandler(Hyperlink_clicked);
 

 

You can implement the customized action in the event handler method and set Cancel argument as true to true to ignore the report action. The following demonstrates opening a new custom window in application when hyperlink action is raised.

C#

private void Hyperlink_clicked(object sender, HyperlinkEventArgs e)
{
     e.Cancel = true; // Set Cancel to true, else it will launch the hyperlink provided in report.
 
     CustomWindow CustomWindow = new CustomWindow();
     CustomWindow.Show();
     CustomWindow.Owner = this;
}

 

Output

 

output

C:\Users\mahendran.shanmugam\AppData\Local\Microsoft\Windows\INetCache\Content.Word\SalesByMonthandYearAlt-KB.PNG

 

Sample

http://www.syncfusion.com/downloads/support/directtrac/general/ze/HyperlinkSample_26_12_2017411156240

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon