Question

I have created a local report on a datasource that has a field named "RelativePath". When my WinForms app renders the report, it exports files to the location specified in the RelativePath field. In the report builder, I set Navigation|Hyperlink action|Jump to URL to "=Fields!RelativePath.Value" and set the report's EnableHyperlink property to true. Whenever my app renders the report, however, the hyperlink is not active. If I hardcode the Jump to URL to an absolute path, however, it works just fine. Does the ReportViewer not render a hyperlink with a relative path?

Was it helpful?

Solution

I have been struggling with the same problem after which i came to the conclusion that the reportviewer does not support hyperlinks with the relative path. To solve this problem is by adding a custom code that retrieves the relative path then concantenate with the field values that you may wish to be part of the URL - atleast that works for me.

Shaddie

OTHER TIPS

I encountered the same issue. To work around this, I created a Report Parameter called "AbsolutePath".

Go to the design view of the .rdlc file. On the "Report Data" tab, you'll see a "Parameters" node. Right click it to:

  1. Add Parameter...
  2. On the General Tab, enter "AbsolutePath" in the Name property.
  3. Click on "Default Values"
  4. Select the "Specify values" radio button.
  5. Add new value "AbsolutePath".

In your TextBox's Action Expression, add something like this ="javascript:void(window.open('" + Parameters!AbsolutePath.Value + "/yourpage.aspx?id=" + Fields!Id.Value + "', '_blank'))"

You can see that the new "AbsolutPath" parameter is available to add to your expression.

Now, you'll need to pass the value into the report's paramter, like so.

    string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority);
    var param = new ReportParameter("AbsolutePath", baseUrl);
    this.ReportViewer.LocalReport.SetParameters(param);

Just use global variable Globals!ReportServerUrl in the expression

= Globals!ReportServerUrl + "yourpath"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top