Reputation: 5
I am trying to dynamically pass a few parameters to the URL via the SSRS Expression. This worked fine:
="javascript:void(window.open('"+ Fields!ReferURL.Value + "','_blank'))"
I also tried to enhanced the destination URL with some parameters to work with and that works fine too. But the problem is that my parameter values have "Spaces" and "Ampersands" which I need to replace by "%20" and "%26" respectively. But the nested replace functions does not seem to work and I still have "Spaces" and "Ampersands" in the URL which I do not want.
My Expression is :
="javascript:void(window.open('"+ "https://www.somewebsite.com/page1.html?site=" + Replace(Replace(Parameters!Site.Value," ","%20"),"&","%26") + "&division=" + Replace(Replace(Parameters!Division.Value," ","%20"),"&","%26") + "&rptdate=" + Replace(Replace(Parameters!ReportDate.Value," ","%20"),"&","%26") + "&rptname=" + First(Fields!ReportName.Value, "DS_Commentary") + "','_blank'))"
Can anyone please help?
Upvotes: 0
Views: 958
Reputation: 14108
Try escaping your URL instead of replacing each reserved character:
="javascript:void(window.open('"+
System.Uri.EscapeDataString("https://www.somewebsite.com/page1.html?site=" +
Parameters!Site.Value + "&division=" + Parameters!Division.Value + "&rptdate=" +
Parameters!ReportDate.Value + "&rptname=" +
First(Fields!ReportName.Value, "DS_Commentary")) + "','_blank'))"
Upvotes: 1