Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

Thanx Francois, your solution is perfect.

I also got one more solution in case anybody needs,

http://blog.mastykarz.nl/imtech-content-query-web-part-v14-exslt/

Thanx.

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
add comment

Your Answer

 
discard

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.