I have defined an Action on my Textbox to Go to an URL. For that I have used Go to URL in Action. Below is my code in the Expr.
="javascript:void(window.open('"+Parameters!url.Value+"'))"
The issue is if the URL has # character in the Parameter then that URL doesn't work and gives me an error as:
The 'Team' parameter is missing a value.
I'm aware that Special characters needs to be encoded and I'm trying to replace the # character but that isn't working.
The Parameters!url.Value is: https://localhost:80/ReportServer/Pages/ReportViewer.aspx?/Reports/End+Dashboard+-+Drilldown&Sprint=10.5&Team=#LetsDoIt&Type=Drilldown
Here you can the see the parameter Team
has value as #LetsDoIt
. For demonstrating purpose I'm using this but on live it is coming from Reports Parameters combination. I'm facing issue only if the Team
parameter has # in its value.
Any help appreciated.
Finally I found a solution with the help of the link provided by Nick.
Problem : I replaced #
with %23
to encode the #
but when the URL was clicked the encoded text %23
was decoded back with #
which was breaking the link to function.
So, I used double encoding for that purpose, I'm replacing #
with %2523
like below :
="javascript:void(window.open('"+Replace(Parameters!url.Value,"#","%2523")+"'))"
So now when it comes to the URL, it only gets decoded once. So the final URL is : https://localhost:80/ReportServer/Pages/ReportViewer.aspx?/Reports/End+Dashboard+-+Drilldown&Sprint=10.5&Team=%23LetsDoIt&Type=Drilldown which works perfectly fine.