Report Designer - Hyperlink property
What is the syntax for the Hyperlink property in Report Designer?
I have a layer with a field which is a web address that I want displayed as a clickable link in the report.
Thanks,
-
The hyperlink property simply takes any valid url, and turns the control into a link to that url.
This link shows how to get a hyperlink out of a database and apply it -- with some modification you should be able to apply this to a field passed from Essentials:
http://www.datadynamics.com/Help/ActiveReports6/arHOWAddHyperlinks.html
Please note that we are not yet on the latest version of ActiveReports, but the above should still be relevant.
0 -
The instructions say:
Double-click the section where the control is located. This creates an event-handling method for the section's Format event.
Add code to the Format event to
Parse the URL out of the HomePage field
Assign it to the HyperLink property of txtHomePage
Remove the URL markers from the text displayed in txtHomePageI don't see where the format event for the section is located. Can you please clarify how to access it?
Thanks,
Sonia Dickerson
0 -
I figured out how to access scripting for the section. Select the section and then select the Script Tab on the bottom where is says
detail - scripts - preview
then I entered the following in the script:
TextBox2.HyperLink = HOTLINK_PATH_TX;
HOTLINK_PATH_TX is a field that is in a datalink for the layer. The values in the field are urls.
But it doesn't work. So I need to know how to get to the datalink fieldnames for this layer.
0 -
Hi Malcolm,
Thanks for this, that has help a lot. I had to make a couple of changes.
The Hyperlink property needs a captial L so HyperLink and the url needed quotes around it, so the line read as follows:-
label1.HyperLink = http://www.latitudegeo.com;
All working now thanks
0 -
I do not know how that happened, the line should read:-
label1.HyperLink = "http://www.latitudegeo.com";
0 -
I am able to show a clickable link - and it works just fine - but I'd like to not show the complete web address. I'd rather show "Click for Info" and carry the functionality of the clickable link. Is there way to do this in the Report Designer? 0 -
Here's how to do it:
1) Set the Text property of your textbox control to Click for Info
2) Set the HyperLink property of your textbox control to the URL you want it to link to
Now I’m guessing that you might want to dynamically generate a URL based on one of your report layer’s field values. If that’s the case, then you can use the script tab to create the URL for the HyperLink property instead.
?
Here’s the code to use:
TextBox hyperlink1 = rpt.Sections["Detail1"].Controls["YourTextboxName"] as TextBox;
string URL = rpt.Fields["YourDataFieldName"].Value as string;
hyperlink1.HyperLink = “http://www.FirstPart.com/” + URL;
If your field contains a full URL, you can pass that directly too:
hyperlink1.HyperLink = URL;
Notes:
- hyperlink1 and URL are just names of a new variables being created by the script, so you can call them whatever makes the most sense to you.
- Detail1 is the default name of the report body. If you changed the name in your report, you also need to change it in the script so it knows what to reference.0 -
Thanks John - But I'm getting errors in both the 'Preview' of the Report Designer and when trying to create a report. I'm entering in the 'ActiveReport' Object the following:
TextBox hyperlink1 = rpt.Sections["Detail1"].Controls["TextBox28"] as TextBox;
string URL = rpt.Fields["smartgov_url"].Value as string;
hyperlink1.HyperLink = URL;
And I've added 'Click for Info' in the text property of the textbox. But I'm getting this error in the preview:
_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000fzdz&feoid=Body&refid=0EMf2000000kBNh" _/_img_0 -
I see that error too if I enter that into a new report with nothing on the script tab. Did you include this opening line?
public void Detail1_Format()
{
TextBox hyperlink1 = rpt.Sections["Detail1"].Controls["TextBox1"] as TextBox;
string URL = rpt.Fields["smartgov_url"].Value as string;
hyperlink1.HyperLink = URL;
}
That tells it where the script is supposed to look (i.e. the Detail1 section, not the PageHeader or PageFooter).
As far as the error, I don't know if the preview will work correctly in Report Designer when you're using this kind of script. You'll probably have to add it to your site and test it directly in the viewer.0 -
When the report (as PDF) is opened in a browser, the hyperlink is opened in the same browser tab. is there a possibility to open the link in a new tab? How can we configure something like target="_blank"?
thanks, Jan0 -
I seem to remember asking the same questions a few years ago, and the answer then was that you can't configure how the link opens. 0 -
FYI the open link in new tab is not really a "Geocortex" concern from what I just read. This link from Stack Overflow describes a bit of the issue on how PDFs view hyperlinks.
https://stackoverflow.com/questions/39762965/open-link-in-new-tab-from-pdf-file0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
12 kommentarer