Including Hyperlinks in Report Designer

How Can We Help?

< Back

Problem

There are times that clients want to include hyperlinks to download a file (or) navigate to a URL in report designer.

Solution

Step 1: 
Add a Label in the report designer and bind the label with the value of the file (or) URL you want to navigate to.

Step 2:
Configure Before Print event for the Label.

Step 3:
In the before print function, implement the following code, which will convert the label as a Hyperlink to download the file.

Example:
Assuming the label is already binded to the file path (or) file name.

private void label9_BeforePrint(object sender, 
System.Drawing.Printing.PrintEventArgs e) {

//custom code starts here
XRLabel hyperlinkLabel =(XRLabel) sender;
hyperlinkLabel.Text = "Download Attachment";
hyperlinkLabel.Width = 200;
hyperlinkLabel.ForeColor = Color.Blue;
HyperlinkLabel.Font = new Font ("Tahoma", 12, Fonstyle.Undeline);

//Set its URL and target.
hyperlinkLabel.NavigateUrl =
"http://salap/glims/upload/"+hyperlinkLabel.Value.ToString();

//hyperlinkLabel.NavigationUrl = "www.xmpro.com";
hyperlinkLabel.Target = "_blank";

//custom code ends here
}
Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X