Filtering list view based on querystring using jQuery?

Using Sharepoint 2010 Content Editor Web Parts (some links dynamically created) List View Web Part

Ability to add additional software or packages to the system extremely limited (so would prefer answers that do not suggest software upgrades/additional different Web Parts)

Notes using javascript/JQuery and have access to SPServices.

Given the services I have access to, is there a way to filter the List View Web Part based on a querystring?

Querystring filter on documents

I have a list of documents who have a property (Related document ID) that I want to filter via query string


should view only documents who have the related ID = 1

I was thinking of using a Highlighted Content web part with a custom CAML query.

This is what I have so far:

<View> <Query> <Where> <Eq> <FieldRef Name='Related_x0020_Document_x003a_ID'/> <Value Type='Text'>{QueryString:PolicyID}</Value> </Eq> </Where> </Query> </View> 

Can anyone with a basic understanding explain how it works?

I just want CAML to accept a query string

QueryString in Search Result webpart does not work for multi-words keyword search

We have SharePoint Pages on O365 with the title of the Page is “Jeffer Steak Seafood”. We can search this page by typing “Jeffer Seafood” in the search result page. However, we create a new page and add search result webpart. Then, we change the query to receive the parameter such as {QueryString.keywords}.

When we access this page with parameter keywords=Jeffer, we get the search result. But when we type keywords=Jeffer Seafood, we get no results. It seems that the QueryString is transform to “Jeffer Seafood” which is the exact search.

So how can we create the search result page from the parameter without the exact search function?

Best Regards,

Amornthep C.

How to decide the part of an Ajax call QueryString in c#

I am encoding the query string in an Ajax call in Javascript using encodeURL() but I can find a way to then decode it on the server (in c#) I use HttpContext.Current.Request[“ID”] to get the parameter values from the query string. In the debugger if I watch Request.QueryString I can see it is fully encoded but it wont Decode.

I have tried using HttpUtility.UrlDecode(HttpContect.Current.Request[“ID”]) but it doesn’t appear to decode it. What am I missing?

Or should I be using a completely different way too get the query values?

Building QueryString from custom object

I have a custom object that is based in the following models:

public class Filter<T> where T : new() {     public T Object { get; set; }     public int Page { get; set; }     public int ItemsPerPage { get; set; } }  public class TransactionFilter<T> : Filter<T> where T : new() {     public DateTime InitialDate { get; set; }     public DateTime EndDate { get; set; }     public DateTime InitialPayment { get; set; }     public DateTime EndPayment { get; set; }     public List<string> Filters { get; set; } }  public class Transaction<T> : Base where T : new() {       public T PaymentObject { get; set; } }  public class Base {     public bool Sandbox { get; set; }     public PaymentMethod PaymentMethod { get; set; } }  public class PaymentMethod {     public string Code { get; set; } } 

And is built on:

var queryObj = new TransactionFilter<Transaction<object>>() {     Object = new Transaction<object> { PaymentMethod = new PaymentMethod { Code = "1" }, Sandbox = false },     InitialDate = new DateTime(2019, 03, 01),     EndDate = new DateTime(2019, 04, 01),     InitialPayment = new DateTime(2019, 03, 01),     EndPayment = new DateTime(2019, 04, 01),     Filters = new List<string>() { "ID", "Customer", "Reference", "PaymentMethod", "Application", "Ammount", "Vendor", "Status", "PaymentDate", "CreatedDate" } }; 

And should be transformed in a querystring like this:


Yes, Filter property is correct, the API needs to receive it this way… and that was my big issue to find a way to properly mount as needed based on the models.

Based on a lot of research, questions, debugging, exceptions and a lot of coffee, I finally got this as a result to build it as it should be:

private string QueryString(object request, string propertyName = null) {     if (request == null) throw new ArgumentNullException(nameof(request));      var queryString = new StringBuilder();      var properties = request.GetType().GetProperties()         .Where(x => x.CanRead)         .Where(x => x.GetValue(request, null) != null)         .Where(x => !x.PropertyType.IsClass || x.PropertyType.IsClass && x.PropertyType.FullName == "System.String")         .ToDictionary(x => x.Name, x => x.GetValue(request, null));      foreach (var (key, value) in properties)     {         if (string.IsNullOrEmpty(propertyName))             queryString.AppendFormat("{0}={1}", Uri.EscapeDataString(key), Uri.EscapeDataString(value.ToString()));         else             queryString.AppendFormat("{0}.{1}={2}", Uri.EscapeDataString(propertyName), Uri.EscapeDataString(key), Uri.EscapeDataString(value.ToString()));         queryString.AppendFormat("&");     }      var classTypes = request.GetType().GetProperties()         .Where(x => x.CanRead)         .Where(x => x.GetValue(request, null) != null && x.PropertyType.IsClass && x.PropertyType.FullName != "System.String" && !(x.GetValue(request, null) is IEnumerable))         .ToDictionary(x => x.Name, x => x.GetValue(request, null));      var collectionTypes = request.GetType().GetProperties()         .Where(x => x.CanRead)         .Where(x => x.GetValue(request, null) != null)         .ToDictionary(x => x.Name, x => x.GetValue(request, null))         .Where(x => !(x.Value is string) && x.Value is IEnumerable)         .ToDictionary(x => x.Key, x => x.Value);      foreach (var (key, value) in collectionTypes)     {         var valueType = value.GetType();         var valueElemType = valueType.IsGenericType                                 ? valueType.GetGenericArguments()[0]                                 : valueType.GetElementType();          if (valueElemType.IsPrimitive || valueElemType == typeof(string))         {             if (!(value is IEnumerable enumerable)) continue;             foreach (var obj in enumerable)             {                 if (string.IsNullOrEmpty(propertyName))                     queryString.AppendFormat("{0}={1}", Uri.EscapeDataString(key), Uri.EscapeDataString(obj.ToString()));                 else                     queryString.AppendFormat("{0}.{1}={2}", Uri.EscapeDataString(propertyName), Uri.EscapeDataString(key), Uri.EscapeDataString(obj.ToString()));                  queryString.AppendFormat("&");             }         }         else if (valueElemType.IsClass)          {             var count = 0;             foreach (var className in (IEnumerable) value)             {                 var queryKey = $  "{key}[{count}]";                 queryString.AppendFormat(QueryString(className, queryKey));                 count++;             }         }     }     foreach (var (key, value) in classTypes)         queryString.AppendFormat(QueryString(value, key));      return "?" + queryString; } 

It’s called in a quite simple way to mount the query and combine with the URL on API request:

var query = QueryString(queryObj); var response = await client.GetAsync("" + query); 

It works as expected and provides the desired result, which is good enough to me, but I believe that it could be achieved on a simple/better way, so I would really appreciate to see a different view about that, if that could be considered as a good approach for this situation, both function and the call for it, to achieve the expected result.


Suggestions for context menu link with querystring value to NewForm results in Page Not Found

Trying to set up a custom action for a library to send querystring parameters to a NewForm on another list using the Navigate to URL option.

Without a querystring value the link works; displays NewForm:


With a querystring value the link does not work; displays Page Not Found:


Manually typing the following in the address bar works; displays NewForm:




Why would manually typing in these paths work, but from the Context Menu results in Page Not Found?