Geocortex Report Designer Hyperlinking Text DataField with Hyperlink Field
Hello,
I've built a Report in Geocortex Report Designer.
The main report, has many embedded sub-reports.
Each sub-report is tied via data connection in Geocortex Essentials to data in a SQL Server Database. So when the user "generates" the report in the Map Viewer the main report is kicked off and then each embedded sub-report pulls data from the database using the DataLink. Field data is pulled using a SQL query in the data connection.
I would like to hyperlink the data from the DataLink field using a URL stored in another field in the database. Is this possible?
0
-
I found a solution to my problem.
1. Add another label control to the sub-report containing the hyperlink label control
2. Set the Datafield property of the new label to the field in the data you want to use (eg [NAMEFIELD]).
3. Add the following code to the Script tab:
public void Detail1_Format()
{
try {
Label lbl = (Label)rpt.Sections["Detail1"].Controls["Link"];
Label lbl1 = (Label)rpt.Sections["Detail1"].Controls["LinkLabel"];
string linkUrl = rpt.Fields["HYPERLINK"].Value.ToString();
string linkLabel = rpt.Fields["NAMEFIELD"].Value.ToString();
lbl.HyperLink = linkUrl;
lbl.Text = linkLabel;
}
catch (Exception e) {
}
}
4. In the properties for the new control created in Steps1-2 Set the Visibility = False0
Please sign in to leave a comment.
Comments
1 comment