Articles in this section
Category / Section

How to handle hyperlink events in application

3 mins read

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

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

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied