Overview:
The below code will allow you to use a URL string as hyperlink in a report. If you have a service that has images stored as a URL, use this method to add them as a hyperlink into your report.
Solution:
?
To add the URL as a hyperlink in a report do the following:
**Where [“Detail1”] is the name of the details section of your report, and [“Comments”] is the name of the field that stores the string URL from the data source, and [“TextBox1”] is the name of the Text box control where the URL will be displayed.
Note: Ensure you use the exact field name from the REST endpoint for the ‘rpt.Fields’ value.
The below code will allow you to use a URL string as hyperlink in a report. If you have a service that has images stored as a URL, use this method to add them as a hyperlink into your report.
Solution:
?
To add the URL as a hyperlink in a report do the following:
- Open up Report Designer or an existing .rpx file
- Add a ‘TextBox’ Control within the detail section of the Designer.
Note: you do not need to add a Datafield to the ‘TextBox’ control, the following script will add the url to the ‘TextBox’ control. - Open the ‘Script’ tab found at the bottom of Report Designer and add the following code:
public void Detail1_Format() { string url = rpt.Fields["Comments"].Value.ToString(); TextBox textbox1 = (TextBox)rpt.Sections["Detail1"].Controls["TextBox1"]; textbox1.HyperLink = url; }
**Where [“Detail1”] is the name of the details section of your report, and [“Comments”] is the name of the field that stores the string URL from the data source, and [“TextBox1”] is the name of the Text box control where the URL will be displayed.
Note: Ensure you use the exact field name from the REST endpoint for the ‘rpt.Fields’ value.
- Save your report and add it into your Site using Essentials Manager.
Comments
0 comments
Article is closed for comments.