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?

  • %20 represents a "space" character. Please refer this link - w3schools.com/tags/ref_urlencode.asp – Rohit Waghela May 3 '16 at 5:24
  • So both the URL you have mentioned are the same. – Rohit Waghela May 3 '16 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. – Viraj Gorajia May 3 '16 at 5:35
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

  • 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. – Brittany Rutherford May 3 '16 at 7:26
  • Is it SharePoint Filter WebPart or you have developed custom webpart? – Ankitkumar Malde May 3 '16 at 8:30
  • it's the default sharepoint webpart working on query string – Brittany Rutherford May 3 '16 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... – Ankitkumar Malde May 3 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.