SPTechWeb Logo
Home About Us  Advertise       
 
 

Content Query Web Part Enhancements in SharePoint 2010




November 30, 2010 —  (Page 1 of 2)
I’m writing this article over my Thanksgiving holiday so I might as well take a moment to give thanks for things that have been awesome in 2010. I have many things I should be thankful for, like family and friends or perhaps that this is the last official thing I need to write in 2010 (for more info on this, here’s a shameless plug for my new book on Amazon) but since this is a SharePoint article, I’ll focus on something that’s been improved in SharePoint 2010.

The Content Query Web Part is one of the “Swiss Army knives” that comes with SharePoint Server. It has always been very helpful for rolling up lists and pages easily. For SharePoint 2010, there are a couple new features that make it even more useful.

New Query Filters
Filters have always existed for the Content Query Web Part, but SharePoint 2010 adds a couple of new options that are extremely powerful. Rather than filtering a column on a specific value, you can now filter by either PageFieldValue or PageQueryString.

PageFieldValue filters the Content Query Web Part by other fields on the page. This means you can place the same Web Part on several pages and see different items in the rollup based simply on the content of a field on that page. The syntax for this filter would be [PageFieldValue: field name].

Alternatively, PageQueryString filters the Content Query Web part by parameters that are sent over the URL. The syntax for this filter is [PageQueryString: query string parameter name]. This filter can be quite useful for making a rollup page seem more interactive than usual.

For instance, you could create a Content Query Web Part that is filtered by a PageQueryString of “category,” and then you could create a page with links that pass over different query strings on the URL like this: <a href="cqwp_page.aspx?category=2">. The Content Query Web Part will then filter results and only show those that match the category that is sent over on the URL.


Pages 1 2 


Share this link: https://sptechweb.com/link/34996

 
 
This site's content Copyright © 1999 - 2013 by BZ Media LLC, All rights reserved.
Legal and Privacy
• E-mail: