0

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?

1

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 :)

0

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.

  • 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 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.