SSRS escape ampersand for sub report link

juniormint 1 Reputation point

I have the following code to use to create a new tab for sub reports:
="javascript:void" &"'"& Globals!ReportServerUrl &"/Pages/ReportViewer.aspx?"&Globals!ReportFolder &"/SRpt_NonInvTransSumBulkDispBalByHauler&CarrierName="&Fields!Carrier_Name.Value &" ','_blank')"

It works well unless I run across a sub report link that contains an "&" i.e. J&B Enterprises.

Can someone please tell me how to escape the ampersand?

Any help will be greatly appreciated!


SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,782 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,561 Reputation points

    Hi @juniormint ,
    From my research, the effective method is to use Escape Function for javascript. The escape() function was deprecated in JavaScript version 1.5. Use encodeURI() or encodeURIComponent() instead.

    You could refer to the case: SSRS - Opening sub-report in a new window "&" issue.
    Hope this helps.
    Best Regards,

    0 comments No comments