Add Cross-References and Hyperlinks
- 2 minutes to read
This topic describes how to add a navigation link to a report element so that the user can click the element in the Print Preview to navigate to other report elements or external resources.
#Add Cross-References
A cross-reference allows you to navigate to an element in the same document.
Do the following to add a cross-reference to a report control:
Set the Target property to
_self
to specify a link in the same document.Set the NavigateUrl property to the target control’s Name property value.
The cursor automatically changes to a hand icon in the Report Preview when a user hovers over the control. You can make a control look like a link by setting its appearance properties (for example, change the color of the text to blue and underline it).
Tip
Report cross-references are preserved when exporting to PDF.
#Add Hyperlinks
A hyperlink is a navigation link whose target is outside the report.
Do the following to add a hyperlink to a report control:
- Set the NavigateUrl property to the target URL string or bind it to a data source field that contains a URL.
- Set the Target property to
_blank
or leave it empty.
The cursor automatically changes to a hand icon in the Report Preview when a user hovers over the control. You can make a control look like a link by setting its appearance properties (for example, change the color of the text to blue and underline it).
#Specify Hyperlinks Dynamically
You can bind an expression to the NavigateUrl property so that the target hyperlink value depends on the current data field value:
'https://localhost:54114/category?' + 'id=' + [CategoryID]
#Insert a Hyperlink in the Label Text
You can show a hyperlink in the text that the XRLabel control displays. For this, enable the AllowMarkupText option and use the href tag in the string assigned to the Text property value.
Syntax:
<href=value>title</href>
The value
string specifies the target URL, and the title
string is the displayed text.