4

In my rich content area I've inserted a Pages Web Part (to show a list of pages in the subsite). I'm using JS Link to customize the presentation of the list.

Can I pass a parameter to the page and use that to filter the list in someway?

/directory.aspx?company=7eleven

or

/directory.aspx?year=2014

1
  • Even if its Pages Web Part, you can still edit the web part properties and edit the view. Follow the steps I have outlined. Oct 21, 2014 at 19:29

2 Answers 2

4

Use a Query String (URL) Filter.

  1. Insert the web part on your page.
  2. Open the web part options and name the parameter (company or year from your example).
  3. Give it a default value if you'd like.
  4. Then use the web parts connections and connect it to your list.

    • Under the connection options choose "Send filter values to".
    • Select your field name that you want to filter on.

enter image description here

8
  • I can edit web part properties, but I don't see anything about parameters. I'm using (Web Part > Apps > Pages).
    – matt
    Oct 21, 2014 at 19:39
  • Add the Query String (URL) filter web part first then set the properties on that web part. You'll see a parameter name there. Then connect that web part to your list.
    – Jordan
    Oct 21, 2014 at 19:42
  • Web part is located at Web Part > Filters > Query String (URL) Filter
    – Jordan
    Oct 21, 2014 at 19:44
  • I don't see Filters under Web Part.
    – matt
    Oct 21, 2014 at 19:53
  • 1
    Got the answer from another question. I had to enable, SharePoint Server Enterprise Site Collection features.
    – matt
    Oct 22, 2014 at 15:28
7

Modify the view using browser and do following

  • Select column from the filter (company)

  • Select contains

  • Enter {company}

  • Or

  • Select column from the filter (year)

  • Select contains

  • Enter {year}

Save and close.

Now open SharePoint designer and edit the view aspx file in advanced mode. Look for

<ParameterBindings>

and add following

<ParameterBinding Name="company" Location="QueryString(company)" />

<ParameterBinding Name="year" Location="QueryString(year)" /> 

Save and close. Open the page in browser and go to

/directory.aspx?company=7eleven&year=2014
2
  • This works brilliantly on the view page. E.g. if the view is called MyView this will work: /site/lists/ListName/MyView.aspx?Filter1=Value1. But I'm trying to get this to work on a Wiki page where I've added a list view web part for ListName, which is connected to another list view web part on the same page. On this wiki page when I select MyView as the view to use in the list view web part for ListName I get an error: Exception from HRESULT: 0x80131904. Any ideas?
    – Submits
    Jan 29, 2016 at 10:01
  • 2
    Got it. For anyone stumbling across this issue, the <ParameterBindings> need to be added under the <XsltListViewWebPart> tag in the WIKI PAGE, not just MyView.aspx. Your answer, Amal, does not require SharePoint Enterprise, so props to you. Thanks!
    – Submits
    Jan 29, 2016 at 10:08

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.