0

I am creating a url that looks like this:

"http://servername/sites/mywebsite/sitespages/page.aspx?ProcessName=my initial process"

But when I redirect SharePoint to that page using:

location.href=   _spPageContextInfo.serverRequestPath + varquerystring;

It sends me to the page with the url looking like this:

"http://servername/sites/mywebsite/sitespages/page.aspx?ProcessName=my %20initial%20process"

and my filter doesn't work on query string. any ideas?

3
  • %20 represents a "space" character. Please refer this link - w3schools.com/tags/ref_urlencode.asp Commented May 3, 2016 at 5:24
  • So both the URL you have mentioned are the same. Commented May 3, 2016 at 5:28
  • There should not be issue if %20 included instead of space. Internally SharePoint will manage it. I have tried it and add value with space also. Yes url encode to space but i get filtered with proper result. Please check once filter webpart configuration with value which has no space. Commented May 3, 2016 at 5:35

1 Answer 1

0

You can use decode URI component to remove all characters added in the URL and retrieve query string values

JSRequest.EnsureSetup();
var q = JSRequest.QueryString["ProcessName"];
decodeURIComponent(q);

Above code will provide you Query String values with Spaces as you have provided for redirection

Below image is screenshot of page containing list view and SharePoint Query String Filter filtering Title column from Query String.

QueryString filtered List View

4
  • I can't do anything after page is loaded, I am using the filter webpart in sharepoint that reads the page once it's loaded. Commented May 3, 2016 at 7:26
  • Is it SharePoint Filter WebPart or you have developed custom webpart? Commented May 3, 2016 at 8:30
  • it's the default sharepoint webpart working on query string Commented May 3, 2016 at 11:17
  • Then it should work by default.. I have just tried executing same.. I am adding screenshot of my trial in my answer... Commented May 3, 2016 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.