SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to show some data from library based on querystring passed in URL. I've placed Content query web part on page and trying to access querystring using PageFieldValue but it is not working as it is moss 2007.

Can anybody tell me how can i use that querystring in cqwp?

share|improve this question
up vote 1 down vote accepted

You could probably get it done by connecting it with a "Query String (URL) Filter Web Part" although I don't have a 2007 VM handy to test-drive it and I don't remember the CQWP being able to receive value from another webpart.

Alternatively, if a little bit of coding can be done, you can extend the CQWP to retrieve a query string value and consume it

public class QueryStringAwareContentByQueryWebPart : ContentByQueryWebPart 
    // Methods 
    protected override void OnLoad(EventArgs e) 
        if (!string.IsNullOrEmpty(this.Page.Request.QueryString["you-query-string"])) 
            base.Filter1ChainingOperator = ContentByQueryWebPart.FilterChainingOperator.Or; 
            base.FilterValue1 = Page.Request.QueryString["you-query-string"]; 
            base.FilterField1 = new Guid("your-field-guid").ToString();
            SPWeb web = SPContext.Current.Web; 
            base.WebUrl = web.ServerRelativeUrl; 

Happy implementation :)

share|improve this answer

Thanx Francois, your solution is perfect.

I also got one more solution in case anybody needs,


share|improve this answer
I wouldn't have mind if you marked my answer and upvote it as the right one instead of your own one ;) – Francois Verbeeck Nov 26 '12 at 11:25
Yes, that is right. :) – J.Shah Nov 27 '12 at 6:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.