The SharePoint Designer

Brand. Design. Amaze.

Jun 16

Parameters and Content Query Webparts

No Gravatar

The biggest difference between SharePoint 2013 Standard and Enterprise for me is the Content Search Query Web part and the search related web parts. Call me an elitist but I almost come to a stand still when I don’t have my favourite web parts on call. On a recent project I was forced to think out the Enterprise box and thanks to colleague I learnt a new trick (new to me, but this has been a work around since SharePoint 2007).

The Problem:

1 list, a column called category which was linked to a managed metadata term set, and a navigation requirement to have a page with a show of the list items per category.

The Solution:

[PageQueryString:]

The How To:

This article explains how to use the url to filter your content query web part. And for me this was a game changer.

Patrick Liang explains how you can use your navigation (I used a term set for mine) to control your “Additional Filter” in your web part.

If you want to filter a Content Query Web Part with the parameters from URL, we can achieve it with OOTB of Content Query Web Part by adding “Additional Filters” in “Web Part Properties”->”Query”. We can add three filters like:

date is greater than [PageQueryString:DateFrom]

And

date is less than [PageQueryString:DateTo]

And

type is equal to [PageQueryString:Type]

Then redirect to the URL: www.mywebsite.com/pages/Filter.aspx?DateFrom=01/01/2012&DateTo=01/01/2013&Type=sports, the query results will be filtered.

 

 

 

Leave a comment

The SharePoint Designer is using WP-Gravatar