0
votes

I am trying to get a report in SSRS to open in a new tab via the Go To URL action of a matrix report. If I create an expression similar to

="http://server/ReportServer/Pages/ReportViewer.aspx?/subfolder/Events&status_param="& fields!Status.value &"&rc:Toolbar=false" &"&rs:ClearSession=True" &"&rc:command=render" &"&rc:Target=_blank"

and click on the link, the report opens in the same tab. Looking at the html in Inspect Element, I see that the link has been translated to

<A tabIndex=2 class=Ad0d357c05259475781d83a1be939ef9312a href="http://server/ReportServer/Pages/ReportViewer.aspx?/Subfolder/Events&amp;status_param=param1&amp;rc:Toolbar=false&amp;rs:ClearSession=True&amp;rc:command=render&amp;rc:LinkTarget=_blank" target=_top>param1</A>

Changing target=_top to target=_blank and clicking the link again opens the report in a new tab.

Any ideas on why my expression is not setting target to _blank and how I can get the report opened in a new tab? I cannot use windows.open as this is blocked.

1

1 Answers

0
votes

I've never been able to get "Target" to work well in SSRS expressions. In my opinion, JavaScript is the simplest way, but you're saying it's blocked. Just so you know, if you wind up with an error in your JavaScript, a click on the link will often do nothing, making it appear as though it's blocked. In case you'd like to retry, the general formula is as follows:

="javascript:void(window.open('" & [Enter URL Expression here] & "'));"

If you ever want to make custom links within a placeholder expression, you can always turn on the "HTML - Interpret HTML tags as styles" option for the placeholder and then embed your own <a> tag as follows:

="<a href=" & Chr(34) & [Enter URL Expression here] & Chr(34) & " target=" & Chr(34) & "_blank" & Chr(34) & ">[Text for Link here]</a>"

Note that CHR(34) simply enters a quotation mark. You could simply use single quotes in the example above but if you were ever mixing HTML with JavaScript in the same tag, then you'd be forced to use the CHR(34).

Let me know if you have any questions!