SharePoint 2013/2016/Online: List View Item filter based on Query String

This SharePoint 2013 tutorial explains, how to do list view item filtering based on query string parameters. We will learn, list view advanced filtering based on query string in SharePoint 2013/2016/Online.

SharePoint list view item filtering based on query string parameters

In SharePoint, by default when you open AllItem.aspx page for any list or library it will come like below:

http://servername/Lists/MyTestingList/AllItems.aspx

But you can do some more advanced filtering by passing, field, and value in the browser as a query string parameter in the SharePoint list.

Syntax:

?FilterField1=[Internal Field Name]&FilterValue1=[Value to filter]

Let us say I have a SharePoint list which has two fields/columns as Title and Country like below:

sharepoint 2013 query string url filter web part multiple parameters
sharepoint 2013 query string url filter web part multiple parameters

Now to filter the list items based on query string we can write URL like

/Lists/MyTestingList/AllItems.aspx?FilterField1=Country&FilterValue1=IN

Your URL looks like below:

query string filter web part sharepoint online
query string filter web part sharepoint online

Here FilterField1 is to give the Column name and FilterValue1 is the value to filter. Here you can use operators like:

=,!=,>,< etc.

Or you can also write like below:

?FilterField1=Country&FilterValue1=IN&FilterOp1=eq

The results will appear like below:

SharePoint 2013 List View Item filter based on Query String
SharePoint 2013 List View Item filter based on Query String

SharePoint List Item Query String Filter on Multiple Values

If you want to filter on multiple values then you can pass values separated by a semicolon(;). See like below:

?FilterName=Country&FilterMultiValue=IN;SL

The URL Looks like below:

sharepoint 2013 query string url filter web part multiple parameters
sharepoint 2013 query string url filter web part multiple parameters

Here we are trying to filter records whose Country is IN and SL. So the results will appear like below:

SharePoint 2016 List View Item filter based on Query String
SharePoint 2016 List View Item filter based on Query String

Remember here the filter column name is the internal name of the column, not the display name.

You can add up to 10 FilterField and FilterValue like below:

/Lists/MyTestingList/AllItems.aspx?FilterField1=Country&FilterValue1=IN&FilterField2=Title&FilterValue2=Item-2……

SharePoint List Item Query String Filter on wildcard characters

You can also filter SharePoint list items filter items based on wildcard characters like below:

/Lists/MyTestingList/AllItems.aspx?FilterName=Country&FilterMultiValue=*IN*

SharePoint 2013 List View Filtering with Query String

Now let us see how to filter record based on a query string parameter in the SharePoint 2013 list view. We implement list view filtering with the query string by using Filter condition, SharePoint designer, etc.

SharePoint 2013: List View Filtering with Query String

Here I have a test list in the SharePoint site, which has two columns Title and Country. We are trying to filter based on query string parameters for the column Country in the list.

First Create a list view. In that new view go to the Filter section and give the condition as Country is equal to {Parm1} which will look like below:

sharepoint list view filter query string
sharepoint list view filter query string

Now if you will try to pass in the query string nothing will come because we have to modify something in the view through the SharePoint designer 2013.

http://win-pfcp2dgt8di/sites/EnjoySharePoint/Lists/MyTestingList/MyTestView.aspx?Parm1=IN

Now open your list view using SharePoint 2013 designer. If you will check the View section, you will see something like below:

<Query><Where><Eq><FieldRef Name="Country"/><Value Type="Text">{Parm1}</Value></Eq></Where></Query>
sharepoint 2013 list view filter query string
sharepoint 2013 list view filter query string
We need to add this parameter to the <ParameterBindings> list.

In the <ParameterBindings add the below tag before </ParameterBindings>

<ParameterBinding Name="Parm1″ Location="QueryString(Parm1)" DefaultValue=""/>
sharepoint 2016 list view filter query string
sharepoint 2016 list view filter query string

This will look like below:

Now Save the view and then if you will pass the value in the query string parameter like below:

http://win-pfcp2dgt8di/sites/EnjoySharePoint/Lists/MyTestingList/MyTestView.aspx?Parm1=IN

The results will appear like below:

sharepoint list view filter query string
sharepoint list view filter query string

You may like following SharePoint customization tutorials:

Hope this SharePoint tutorial explains, how to implement List View Item filtering based on Query String parameter value in SharePoint 2013/2016/Online.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

  • Hi Bijay,

    How do you filter based on a value being in a long string of text? Like so: Allowed Districts: 01; 02; 03; and I want to filter the view based on wanting to see every item where this string contains 02? I am using column formatting and cannot figure out the format for that using json:

    &FilterValue2=”,”[$District]”,”

    The above works only if 02 is the only value in that column and adding ‘*’ either within or outside the double quotes for $District is not valid.

  • >