4
votes

I am using SQL reporting services 2008 R2, and in one of my reports I am using the Placeholder text to render an html link (anchor) to open a page in another window, The expression text is as below:

="<a target='_top' href=""http://www.google.com""  >Print</a>"

however, when the report is rendered in the browser, the target='_blank' is not there, as if the SSRS renderer is ignoring it.

I tried before to use JavaScript to open in a new window, but that did not work on the client machine, because I am hosting the SSRS reports in an Iframe hosted in another web application, and both the web application and the SSRS report server are on different domains. This issue can't be solved using JavaScript according to this link

So the question is why is the SSRS renderer ignoring my target="_blank" attribute

4

4 Answers

7
votes

I have done this before with javascript. On the "Action" tab of your link's Textbox properties, select "Go to URL". Then enter this script in the "Select URL" expression:

javascript:void(window.open('http://www.google.com', '_blank'))

If you need the URL to be passed by your dataset, you can do this:

="javascript:void(window.open('" & Fields!YourURL.Value & "', '_blank'))"
6
votes

I finally found it with the help of a friend, to force SSRS report to open links in a new window, just add the following Query string parameter to the URL of the report: &rc%3ALinkTarget=_blank So for example the final url will be:

http://myreportserver/ReportServer?/MainSSRSFolder/MyReport&rc%3ALinkTarget=_blank

This will make all the links in the SSRS report open in a new window

6
votes

If you are using a reportviewer control in an ASP.NET page, you can also set the attribute HyperlinkTarget="_blank" to apply this to all links on the page without javascript calls.

2
votes

Of course I can't really tell you why the designers chose this. I can probably get you the closest you can get to a confirmation that this in fact as designed, i.e. "that it is in fact ignoring the attribute".

The MSDN lists supported HTML in SSRS, quoting that article:

• Hyperlinks: <A HREF>

• Fonts: <FONT>

• Header, style and block elements: <H{n}>, <DIV>, <SPAN>, <P>, <DIV>, <LI>, <HN>

• Text format: <B>, <I>, <U>, <S>

• List handling: <OL>, <UL>, <LI>

From the first bit I'd infer/guess that only the href attribute on a tags is supported.