We all know the Content Query Web Part shipped with MOSS 2007. It is so far the best content aggregation solution available. While it is extremely flexible and allows you to define your own presentation layer, it lacks some basic aggregation features like results paging and dynamic content filtering. While Andrew Connell has presented recently a nice approach to achieve last one, I have decided to focus on the paging functionality.
Customizing the Content Query Web Part isn't always as easy, as many of us SharePoint developers would like it to be. Next to some general programming skills and knowing the SharePoint object model you have to do some digging on how the CQWP works and where it allows you to plug in. One of the greatest example of customizing the CQWP is the Enhanced Content Query Web Part by Ishai Sagi. If you're interested in extending the CQWP it is definitely a nice point to start. Back to the paging…
I don't think I need to explain the idea of paging results: a Web Part supporting paging should give you at least the possibility to define how many items you want to display per page.
The Pager
I took the requirements a step further: I have decided to detach the Paging functionality from the CQWP so that if you don't want it at a particular place, you can simply "turn it off" and use the regular CQWP functionality. To provide that flexibility I have decided to use the concept of connectable Web Parts and let the CQWP send the required paging information to the Pager Web Part. The data displayed by the CQWP would change upon selecting a page. Two problems arise at this point.
First of all the pager would have to be a consumer and provider at the same time. Based on the retrieved paging data (how many pages are there, and which page are we currently on) it would render the pager. After selecting a page it would provide this information to the CQWP so it can modify the displayed data.
While a Web Part can be both consumer and provider at the same time, it can't be done to retrieve and provide data to one and the same Web Part at the same time.
Another issue arises when considering accessibility. By providing the current page information using the Web Part Connection concept, there is now way of accessing the particular results page by using the URL only. The current page information is being stored in the interface which both Web Parts implement, but you cannot persist it in the URL.
In order to solve both issues, I have decided to make the Pager Web Part a receiver and let the CQWP use a query string parameter to determine the current page. By placing that information in the interface both Web Parts implement, the CQWP knows which variable contains the information about the current page and the Pager Web Part knows which variable it should use for rendering the links to particular pages.
As for the presentation layer I have decided to leverage the concept presented by the CQWP and support XSL. The Pager itself produces XML which can be modified to suit any chrome using XSL.
Extended Content Query Web Part
The Extended CQWP supports paging by using a query string parameter. After setting the basic properties: number of items per page and the name of the query string parameter which contains the current page number, the paging is on.
I will try to provide a 'How I did it' with some more details on the Web Part next week. In the meanwhile you can download the wsp containing both Web Parts and check them out.
















June 19th, 2008 at 11:52 am
Hello,
I placed both webparts on a page and connected them. But the ExtendedContentQueryWebPartPager shows "no items found". What can I do to solve this?
Thanks for your answer.
June 19th, 2008 at 5:11 pm
Hello Diana,
Thank you for your feedback. I've noticed that the connection doesn't work properly if you add both Web Parts at the same time. After I've added the ExCQWP first, published the page and then added the Pager and setup the connection it all worked properly. If you're in a hurry, you can use this approach. Unfortunately I can't promise when I will have time to come up with a solution to this issue.
Good luck!
June 25th, 2008 at 1:22 pm
Hello Waldek,
I tested your Paging content query web part and all works fine. nice work btw!!
Could you please make the source available at codeplex because I want to edit it a litle. If you browse to the page with the webparts without a request variable the pager doesn't display anything. maybe I can add a default value for the variable.
Thanks Bart
June 25th, 2008 at 1:30 pm
Hi Bart,
Thank your for your feedback. I have added the default value as well, yet didn't have time to publish it yet. I will try to post the source as soon as possible.
Waldek
June 25th, 2008 at 1:37 pm
Hi Waldek,
that was really fast :-)
thanks and keep up the good work.
Bart
June 25th, 2008 at 8:41 pm
Hi Waldek,
I think you have a bug on the paging calculation. If you have, for example, 17 items, showing 5 items per page, we only get 3 pages instead of 4.
We've checked with .NET Reflector, and this seems wrong:
In the ProcessItems method of the ExtendedContentQueryWebPart class you are calculating the number of pages with Math.Round:
this.numPages = (int) Math.Round((double) (((double) dt.Rows.Count) / ((double) this.ItemsPerPage)));
(the result should be 17/5 = 3.4 and this should ceiling to 4, instead we get 3)
Should't Math.Ceiling be used instead of Math.Round?
Nice work, by the way!
Kind Regards,
Nuno Leong and André Cunha
June 25th, 2008 at 10:47 pm
Hi Guys,
Thank you for your comment and research. I really appreciate it. You're absolutely right: while focusing on the functionality I have totally forgotten about rounding the division in the right way. As you've probably seen in my previous comment, I'm planning to share the source code as well. I will definitely include the fix.
Thanks again,
Waldek
June 30th, 2008 at 1:47 pm
The pager webppart is connected to the CQWP, but now we cannot filter the CQWP anymore because only one connection to the CQWP is possible. It would be great if the CQWP could have more than one connection in a future release. Thanks.
July 2nd, 2008 at 1:43 pm
Hello Waldek,
Could you please send me the sourcecode of your extended CQWP. I work at orbitone and we want to merge the enhanced CQWP and your webpart. We already added an additional filter to the enhanced CQWP to use request variables. When we finish we will share the code.
thanks Bart
July 10th, 2008 at 1:14 pm
Hi
Thanks a lot ! this realy save me time.
if you see "no items found" make sure that :
1) Items per page is not 0
2) you set the querystring propety
3)you pass a value to that query string (e.g pageNum=1)
Thanks again,Nir
July 14th, 2008 at 3:27 pm
Hello,
Nice work, are you thinking on releasing the source code and allow other to contribute with new functionalities? I beleive this component is very usefull and many people (including myself) want to use it and be able to include some custumizations and develop new functionalities.
Best Regards,
André Cunha
July 16th, 2008 at 9:27 am
Landed here from another Google. Just proves your excellent post content :-)
Any how, after grabbing this extended CQWP I have 2 questions.
1. I had to change in web.config the trust level from WSS_Minimal to WSS_Medium. In figuring out what to do I found that trust levels can be configured in the manifest.xml. Seeing you haven\'t put anything in the manifest have you in your own environment changed the trust level to Medium?
2. After sorting the trust levels and actually seeing the webparts on my page the Query Web Part has an initial issue. \"Unable to display this Web Part. To troubleshoot…..\"
I have played with configuring the web part but nothing changes.
Also thanks for the pointer to here from the other comment. Funny how landed here any way.
July 16th, 2008 at 8:16 pm
In my development env. I use the Full trust. You should give it a try and check whether it will help you.
July 18th, 2008 at 8:37 am
dear all,
I cannot connect two WP.
help me, pls
July 18th, 2008 at 9:02 am
ok, i've aready set up it right
thanks
July 24th, 2008 at 5:43 pm
Waldek.
I'm trying to inherit from the CQWP just as you do.
It works. But an error occurs occasionally when setting values in the tool pane and I can't figure out why. I can't replicate it step for step yet but the error is "failed to load view state". It hints at the controls being different. But the controls in the tool pane are created in the createchildcontrols.
Any tips on how I can figure out what my problem is or what I should avoid doing?
July 24th, 2008 at 7:06 pm
Could you mail me the code? I could try to look at it.
August 8th, 2008 at 11:57 am
Thanks W. for your solution.
Do you also have a good solution for having the paging functionality in the same webpart??? Didn´t manage to merge the two you have created.
Thanks man..
August 8th, 2008 at 4:32 pm
Could you perhaps describe your problem a bit more? Unfortunately I've got no all-in-1 solution for paging using the CQWP but you could do it easily by merging the code. I don't know how experience you are as developer but it wouldn't be difficult.
August 13th, 2008 at 7:20 pm
Hi Waldek,
ive deployed your solution files but when i try to preview the webparts, then i got error "An error occured when previewing the Web Part. "
what can be the reason
Thanks
August 15th, 2008 at 1:33 pm
Hi Ross,
I'm not really sure whether the Preview works correctly. Have you tried putting both web parts on a publishing page? It should work there.
October 22nd, 2008 at 3:59 pm
Hi is the source code wsp and actual wsp on codeplex different versions? Perhaps it should be updated to reflect this.
November 4th, 2008 at 12:50 pm
hi Waldek,
did you put the source code?
thanks in advance
November 4th, 2008 at 1:03 pm
I'm going to update the .wsp. In the meanwhile you can build a new WSP using the updated source code.
November 4th, 2008 at 1:09 pm
mdarwish: the source code is available on CodePlex, see the Tools section for the link
November 18th, 2008 at 4:35 pm
Help me.
I try to deploy whole day.
But I always receive error: "No Items found"
November 18th, 2008 at 5:32 pm
I have done
Thanks you so much Waldek
You save my life
November 26th, 2008 at 4:00 pm
Hello :)
I have some problems in order to view itmes :
1-I am using a custom list with announcment content type.so when I configure the content query webpart and then at the number of items per page it gives that error :
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.
But when I try the same setting on a normal content query webpart ,it works fine .
So may I ask for help on how to solve this ..please :)
Thanks :)
November 26th, 2008 at 6:51 pm
@Hdevelop: the error you have mentioned has most of the time something to do with XSLT. Have you modified anything there by any chance?
November 27th, 2008 at 10:36 am
no none …its the same xslt which works on the normal content query webpart but not on the extended one.
November 27th, 2008 at 3:42 pm
@Hdevelop: that's strange. Anything else you've changed?
December 21st, 2008 at 2:12 pm
hey i got a requirment of doing the paging plus some timer thing so content keeps scrolling line by line showing the rollup image along with it. before i try to reinvent the wheel , have anyone done this thing before
January 29th, 2009 at 12:17 pm
Hey, I don´t understand how to connect the two webparts.
I klick on the Open the tool pane on the pager webpart but i can´t find where to connect to the CQWP.
January 29th, 2009 at 1:46 pm
@Amir: You connect the CQWP to the pager just as you would connect any other two Web Part. Edit the Page, then from the Web Part edit menu choose Connections and connect it to the pager.
January 29th, 2009 at 1:46 pm
Never mind i got it to work, for anyone else as blind as me…the connection link is in the edit meny of the pager webpart. :-)
January 29th, 2009 at 1:48 pm
Thanks for the answer ! I posted the same answer at exactly the same time. What are the odds of that happening :-)
February 11th, 2009 at 2:51 pm
Hi !
I'd like to test your webpart but I am still faced to an error message : "unable to add selected web part(s) extended content query web part : cannot import this webpart".
What I have to do to fix it ?
February 11th, 2009 at 6:55 pm
@Stéphane: Can you confirm that the solution has been deployed correctly? Additionally you could try to disable custom errors in web.config to get more background information on the error that you're facing. The web part work on a Publishing Site only: can you confirm that you're activating the Feature on a Publishing Site?
February 12th, 2009 at 8:40 am
After I set "Item per page:" it return "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator." How to fix it?
February 12th, 2009 at 1:59 pm
Hi,
Thanks for your reply..
After changing the trust to WSS_Medium, it works !
Thanks a lot
Good job !
February 12th, 2009 at 6:21 pm
@Dada: If you've made any changes to the XSLT that's probably what's causing the error. I'd suggest you carefully examine your XSLT and check whether everything has been done correctly.
February 12th, 2009 at 6:21 pm
@Stéphane: great to hear it's up and running :D
March 5th, 2009 at 4:13 pm
Hi, after I set "Page Library" in "list type" it return "Unable to display this Web Part. To troubleshoot the problem…." if I set another kind of list, everything works fine… but I need "page library" :(
March 6th, 2009 at 10:46 pm
Hi, great job.
I found one issue. Paging doesn't work for anonymous user. How can I fix it?
March 6th, 2009 at 11:05 pm
@Andrew: could you provide some more information on the issue that you're experiencing? I've been using that approach myself in many WCM solutions targeting anonymous users and never had any problems.
March 6th, 2009 at 11:47 pm
I found what was the problem. I turn on caching profile for anonymous users in site settings.
Once again – great job.
March 6th, 2009 at 11:50 pm
@Andrew: Great to hear it all worked out. Thank you very much, I appreciate it.
March 10th, 2009 at 8:43 am
Hi Waldek
Getting error while deployment.
Can u send me deployment steps ??
"The "ExtendedContentQueryWebPartPager" Web Part appears to be causing a problem. Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed."
March 10th, 2009 at 9:05 am
@Ali: how did you deploy the Web Part: to bin or to GAC? What trust level did you set in your web.config?
March 10th, 2009 at 9:16 am
Hi waldek,
It is working fine when i set the trustlevel to meduim.
I have added a New Content Query webpart and ExtendedQuery webpart on the page.
But i dont now how can i connect them.
The option "get paging data From" is disabled.
Can u help me to achive my goal.
thanks for your quick response
March 10th, 2009 at 5:48 pm
@Ali: You need the Extended CQWP and the Extended CQWP Pager in order to do paging of the query results. HTH
March 17th, 2009 at 9:33 pm
Hi,
After deploying to the GAC I'm off. Can you give me a clue on the data that needs to be entered in to the web part tool part for Common View Fields?
I'm sure its obvious but I keep getting the "There is a problem with the query…" message.
Many thanks
March 17th, 2009 at 11:38 pm
@Steve: CommonViewFields is an optional property of the CQWP which allows you to include fields in the output other than the default Title, Description, Link, Image, etc. The required format is InternalName1,Type1;InternalName2,Type2, eg. Title,Text;PublishingPageContent,HTML
And as for your error: you should have a look at my latest post about debugging the CQWP. It might give you some more idea about the errors you're getting: http://blog.mastykarz.nl/debugging-content-query-web-part/
March 27th, 2009 at 5:07 pm
Hi,
I've some troubles with the pager webpart. I see the error message : "no items found". I display 5 items per page and I insert Enhanced CQWP before the pager webpart.
Thanks to help me.
March 28th, 2009 at 3:16 pm
@david: Have you connected both Web Parts correctly? Any more details you could provide, like: whether the Web Part works correctly without the pager and whether you checked that it's not because of the Pager's XSLT?
April 3rd, 2009 at 11:05 am
Hi
we have a page where I connected the three list webparts and we are implementing the item level security. But the issue is Iam not able to see the items in the connected webpart though the item exists. When I go to the list page or the view which is connected, I am able to see the items there with my credentials.
Can you help me out in digging this issue. I need to resolve this ASAP.
Thanks
Sireesh
April 3rd, 2009 at 11:08 am
I forgot to mention that I have permission on those items. But still not able to view those items.
April 3rd, 2009 at 1:56 pm
Hi,
I get this error when I add Extended content Query webpart to my page. However pager webpart loads properly in the page.
i set trust level to Medium in web.config
Please help me resolve this issue. I need to implement paging for my cqwp
" Error Rendering Control – g_c4962cf9_4d20_4e0b_9806_e3617e27d3aaAn unhandled exception has occurred.
Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Thanks,
Sunanda
April 3rd, 2009 at 11:14 pm
@Sireesh G V: does your question refers to the standard List View Web Parts or the Content Query Web Part?
April 3rd, 2009 at 11:17 pm
@Sunanda Yalamanchili: as far as I can tell you: try to set the trust level to Full. The Extended CQWP I shared is a dev code as was never meant to be used in production (it's also not supported that way). If it works and it's something that suits your needs you could pick it up to create a supported web part out of it on your own.
April 6th, 2009 at 9:01 am
Hi I add the standard list view webparts to the page.
May 10th, 2009 at 12:28 pm
Hi,
big thanx for your article and your ECQWP. I have used your webpart in a site with variations. when I publish a page containing the ECQWP (using an administrator account) in the principal language the mirroring effect is achieving correctly in other languages (I have the ECQWP and its pager which work correctly). However, in anonymous access mode I get correctly the EQWP and its pager in the principal variation but for other variations, the pager cannot retrieve the pages. I have tried to add from scratch the ECQWP but i have the same problem with the pager web part.
May 10th, 2009 at 3:35 pm
@ramzi: first of all, have you checked that the Web Part is retrieving the pages from the right site? Secondly: have you published the pages you want to aggregate? If there is no published version you might not see them in the aggregation results.
May 10th, 2009 at 7:58 pm
Hi,
thank you very much. the problem concerns the publishing status of the pages. So I have approved the pages and there is no problem now. thank you very much.
June 18th, 2009 at 10:39 am
Hello Waldek,
I would like first to thanks you for your ECQWP.
I don't have big information on webpart but. So, i don't know life cycle of webpart.
In fact, I want to personlize a webpart to get refreshment after an event (click on button added to the same webpart).
Which method enable the webpart to reexcute the query !
We have developped a custom webpart that override some methods such as onLoad(), CreateControls()… but the problem is that when the attributes are modified after first load (applying first valued), the webpart don't apply the new values.
10x
June 18th, 2009 at 10:38 pm
@The Gost Is Me: you mean you would like to have a CQWP with server controls? To be honest it's the first time I hear such case. Could you share any more details about your requirements? I'm really interested in it and curious if CQWP is the right thing for you to use.
June 21st, 2009 at 12:05 pm
Hi,
this link presents my need
http://img23.imageshack.us/img23/592/serverextendedcqwp.jpg
thanks,
June 21st, 2009 at 12:14 pm
@The Gost Is Me: Why won't you then create two controls: one to do the filtering and put the selection in the query string, and another (CQWP) to grab the filter selection from the query string parameters and include it in the query to display the proper results? Seems a lot easier than modifying CQWP to include controls. Additionally it will allow you to persist the state of the selection so that if a visitor sends the URL to someone else, they will see exactly the same page instead of the default data.
July 14th, 2009 at 3:46 pm
Hi Waldek,
i appreciate your quick response.
I have deployed ECQWP through GAC. I got the ECQWP working and was able to connect the pager. But I keep getting no items found for the pager no matter what i do.
I need to resolve this very quickly.
Thanks
July 15th, 2009 at 6:52 am
Hi Waldek,
I have deployed ECQWB in GAC and had it working except for paging, I was also able to connect them. But pager keeps displaying "no input found". I appreciate your help.
July 15th, 2009 at 6:13 pm
@abulut: Have you checked with the comments above? Perhaps one of them contains a solution to your problem?
August 5th, 2009 at 3:21 am
Hi, I have the same problem as abulut, I successfully deployed the 2 web parts, but ECQWPP keeps displaying "No items found" no matter what I do. I have a Site in Spanish.
I hope you can help me.
August 5th, 2009 at 6:13 am
@David: have you checked with the comments above to confirm that your problem doesn't resemble one of those described earlier?
September 14th, 2009 at 7:25 pm
I have successufly installed your ECQWP parts. I have a requirement to have two of these on a page. However, the default XSLT breaks the other paging by removing the URL string. How do I keep the entire URL and only replace with the new page number so the second set of parts still function.
September 15th, 2009 at 7:35 am
@Tim Allison: As far as I can see it in the Pager's code the query string is included in the XML output (Pages/QueryString) but is being skipped in the XSLT. You could fix this by modifying the Pager's XSLT and including the value of the QueryString in the pages links.
September 18th, 2009 at 12:18 pm
Hi Waldek,
I am trying to apply current user filter to custom query from ms sql 2000. But if custom sql statement have any function like substring or table Alias, i get error:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.
Without any function, table Alias it work fine.
Any ideas? Thanks!
September 20th, 2009 at 1:13 pm
@Malrok: I think your question is a bit off-topic. I suggest you try to ask at http://mssharepointforums.com. Perhaps someone there had a similar problem and knows the answer.
September 25th, 2009 at 11:35 am
Hi Waldek,
Really great webparts!
However I have 2 questions:
1 – why don\'t I get a querystring like ?page=1
Do I need to do anything extra? If I add ?page=1 manually to the URL it works like a charm. Paging stuff is displayed and fully functional. Problem is that the querystring isn\'t added to the url
2 – I have a site where we put a querystring to the URL. Can your webparts handle this?
E.g we have an URL: mysite:9000/MySite/Page/News.aspx?m=78
I cannot get your pager webpart working on this site (not even manually)
Thnx!
October 1st, 2009 at 7:12 am
@Sander:
1) You mean in the pager links? Those are XSLT based so if something doesn't work as you would expect it to, you can fix it by simply editing the XSLT.
2) Using query string shouldn't be a problem. The only thing I can imagine is your site using the same query strings as the CQWP.
October 5th, 2009 at 6:29 am
Hi Waldek,
I have deployed and connected the 2 web parts on a publishing site, but keep getting "No Items Found" message displaying in the pager web part.
When I tick the Display XML option in the properties of the Pager web page, there is no XML dispalyed.
According to a previous post
if you see "no items found" make sure that :
1) Items per page is not 0
2) you set the querystring propety
3)you pass a value to that query string (e.g pageNum=1)
I have done 1 & 2 and the correct no. of items are displayed in the ECQWP. How can I ensure that a value is being passed to the query string?
Thanks,
Brendan
October 5th, 2009 at 7:06 am
@Brendan: 1) Have you read all the above comments to see if your case hasn't been already solved?
2) Have you added by any chance both Web Parts at one time? I noticed that in some situations the Pager doesn't work. Removing it, and readding seems to solve the issue.
October 8th, 2009 at 7:27 am
Waldek,
I added the web parts separately, but still get the no items found message.
Removing and adding the Pager web part doesn't work either.
October 8th, 2009 at 7:33 am
@Brendan: Is it only the pager that you're getting issues with, or do both Web Parts fail to work?
October 8th, 2009 at 7:55 am
Just the pager. The Extended CQWP works fine.
October 8th, 2009 at 8:09 am
@Brendan: That's weird indeed. The only thing I could think of, is that you download the source code and try to debug it in your environment.
October 26th, 2009 at 9:26 am
Hi why my page display like this
.1
.2
.3
>>
How can i change to display as follwing
1 2 3 >>
Thanks
Nithi
October 26th, 2009 at 5:08 pm
@Nithi: You can use CSS to make the list items (li) display in-line (display: inline).
November 3rd, 2009 at 4:05 pm
Well Done Waldek , you save our times :)
I got both CQWP with pager configured and load the data , but the issue is the guery string doesn't pass a value to the pager , but if i hardcoded the ?page=1 it will work fine and the pager will get the page counts and everything is fine!! , so what is the issue??
Thanks
November 13th, 2009 at 11:47 am
Enhanced content query is not returning any results
November 13th, 2009 at 3:05 pm
Can anyone please tell me how did you make the pager web part work..its always telling "Item Not Found"….Extended content query web part though is working like a charm
November 13th, 2009 at 4:14 pm
Nithi or Sibai ..can u plz tell me how did u make it work
November 14th, 2009 at 1:57 pm
@Smruti: Have you checked will all the previous comments, if the issue that you're experiencing hasn't been solved there?
November 16th, 2009 at 10:21 am
Hi Waldek..Thanks for replying.. Yes i studied all the above comments and have tried them all .. I also tried to set the querystring as Page=1, pagenum=1 etc….but pager web part doesnt work at all…Extended CQWP works fine now … I had to change trust level= full to make it work..Can you please tell me if any configuration is needed…..i made the necessary web part connections also..Its kinda urgent so i dint want to delve into coding ………..i dont know how sibai and nithi have been able to make it work….please help me..
November 16th, 2009 at 3:19 pm
Dear Waldek,
I've downloaded the .wsp file, Can you please provide me with the steps of how to deploy your solution?
it's too much appreciated.
Thank you in advnace,,,
Regards,
Mohammad Akilan.
November 18th, 2009 at 4:28 pm
Hi Mohammed,
Just do the following steps:
1.Download the .wsp file
2.Put the file in ..12/bin/
3.Run this command "stsadm -o addsolution -filename ExtendedCQWP.wsp
4.Goto Central Admin->Operations->Solution Management
5.Deploy the ExtendedCQWP.wsp file(Specify the web application)
6.Goto your sharepoint site settings->Site collection feature->Activate the ExtendedCQWP.wsp
7.Now the Extended CQWP & Extended CQWP Pager webpart is added in webpart gallery.
8.Just add the webparts(Both ECQWP & Pager) in your page where you need.
9.Connect the webparts(Click the connections(next to modify shared webpart).
10.In Extended CQWP ->Modify shared webpart->Data view ->Query string variable(Type "page")
11.In "items per page" give the value more than 0.
12.Publish the page
13.At first time just append "?page=1" in url,then only it will work.
If u need more info..just go thru the above thread.
November 19th, 2009 at 6:44 am
Good one Suresh. Worked for me when I appended "?page=1" in the URL :)
November 25th, 2009 at 12:17 pm
Hi,
I'm struggling to display the Attached Documents(Announcements List) in Extended CQWP.is it possible in ECQWP?Pls let me know.It's very urgent.
November 25th, 2009 at 12:28 pm
@Suresh: The ECQWP uses exactly the same XSLT as the CQWP so it shouldn't be any different than while using the standard Content Query Web Part.
November 26th, 2009 at 12:46 pm
Thanks Waldek.
December 23rd, 2009 at 7:37 am
Dear Waldek Mastykarz,
Thanks for the nice work. I am using this web part all over the project. I am facing lot of problem while the page is checked out and submit for approval, i am getting the below messages in the logs. Please help me as soon as possible i am in trouble bcoz of that messages.
12/21/2009 21:53:27.84 w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium Potentially excessive number of SPRequest objects (17) currently unreleased on thread 21. Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed. Allocation Id for this object: {939D417D-ACF2-42B2-8AAB-FC741542CB7E} Stack trace of current allocation: at Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable) at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPWeb.InitializeSPRequest() at Microsoft.SharePoint.SPWeb.EnsureSPRequest() at Microsoft.SharePoint.SPWeb.get_Request() at Microsoft.SharePoint.SPWeb.InitWebPu…
12/21/2009 21:53:27.84* w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium …blic() at Microsoft.SharePoint.SPWeb.get_ServerRelativeUrl() at Microsoft.SharePoint.SPWeb.GetWebRelativeUrlFromUrl(String strUrl, Boolean includeQueryString, Boolean canonicalizeUrl) at Microsoft.SharePoint.SPWeb.GetWebRelativeUrlFromUrl(String strUrl) at Microsoft.SharePoint.SPWeb.GetFolder(String strUrl) at Microsoft.SharePoint.SPList.get_RootFolder() at Microsoft.SharePoint.WebPartPages.BaseXsltDataWebPart.get_RootFolder() at Microsoft.SharePoint.WebPartPages.BaseXsltDataWebPart.ResolveMondoCAMLParamValues(XsltArgumentList argList, BaseDdwRuntime runtime) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.ResolveParameterValuesToXsl(ArgumentClassWrapper argList) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform() a…
12/21/2009 21:53:28.25* w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium …rocHint(Int32 hint) at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint) at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId) at Microsoft.SharePoint.Publishing.CachedArea.GetIdentityWeb(Guid webId, SPSite elevatedSite, Boolean isSuperUser) at Microsoft.SharePoint.Publishing.CachedArea.GetSuperUserIdentityWeb(SPSite site) at Microsoft.SharePoint.Publishing.CachedArea.GetCrossListQuery(SPSiteDataQuery query, SPWeb currentContext) at Microsoft.SharePoint.Publishing.CrossListQueryCache.GetSiteData(CachedArea cachedArea, SPWeb web, SPSiteDataQuery query) at Microsoft.SharePoint.Publishing.CrossListQueryCache.GetSiteData(CachedArea ca) at Microsoft.SharePoint.Publishing.CrossListQueryCache.GetSiteData(SPSite site, String webUrl) at Microsoft.Sh…
12/21/2009 21:53:28.25* w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium …arePoint.Publishing.CrossListQueryCache.GetSiteData(SPSite site) at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.IssueQuery() at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformSelect() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.DataBind() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.EnsureDataBound() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls() at Imtech.SharePoint.WebParts.ExtendedContentQueryWebPart.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Cont…
12/21/2009 21:53:28.25* w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium …rol.PreRenderRecursiveInternal() at System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(…
12/21/2009 21:53:28.25* w3wp.exe (0×0868) 0×0310 Windows SharePoint Services General 0 Medium …HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr) at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
December 23rd, 2009 at 10:52 am
@Murali: as you can see in the stack trace this messages are a part of the SharePoint API and have nothing to do with the extensions that I built on top of the Content Query Web Part. Please note that the log messages that you see are simply warnings, meaning that not necessarily there is something wrong with your site and the way it uses memory.
January 11th, 2010 at 2:41 pm
Thanks to you.
I've a BDC which display it by Business Data List Web Part. But it seems does not support paging. How could I connect BDC to Content Query Web Part, so could have paging with extended version of it.
Thanks
January 11th, 2010 at 10:51 pm
@Kambiz: I don't think you should use the Content Query Web Part as a pager for your BDC Web Part. Instead you should create a new Web Part for that particular purpose.
January 15th, 2010 at 1:05 am
[...] Paging Content Query Web Part We all know the Content Query Web Part shipped with MOSS 2007. It is so far the best content aggregation solution available. While it is extremely flexible and allows you to define your own presentation layer, it lacks some basic aggregation features like results paging and dynamic content filtering. (tags: sharepoint2007 content-query webpart customize) [...]
January 29th, 2010 at 1:54 pm
After spending ages to get this to work realised the wsp should really deploy to the GAC as modifying the TRUST setting in web.config yields unpredictable results. I can now see the content in the ECQWP and the page numbers in the Pager, but only in page edit mode :-(, the minute I exit page edit mode the ECQWP shows the "no items" message and the Pager is blank :-(
March 16th, 2010 at 4:03 am
Is it work on WSS3.0? IF not, How to do that on WSS3.0?
Thank you
Phodchara
March 16th, 2010 at 7:45 am
@Phodchara: The Content Query Web Part is available with the SharePoint Server only. If you want a similar solution for WSS, you will have do develop it yourself.
June 11th, 2010 at 3:08 pm
Random results. Sometimes the ECQWP gets all items I am querying, but sometime sonly 45. I spent hours finding for a solution for this any ideas?
September 16th, 2010 at 8:05 pm
i am working on Sharepoint 2010 i have deployed this webparts but it giving me error while adding into site page 'can't import this web part' ,let me know how to solve this issue..
September 17th, 2010 at 3:39 pm
@share2010: have you read previous comments to see if anything reported there resembles your scenario?
October 19th, 2010 at 4:15 am
Hi Waldek,
What's the simplest way to modify the solution to get it to deploy to the GAC instead of the app bin?? I really need to get around this trust issue for our public-facing sites.
October 19th, 2010 at 4:59 am
Ah…got it. Change DeploymentTarget="GlobalAssemblyCache" and add the assembly details.
But will it work…?
October 19th, 2010 at 5:03 am
@Panoone: yep, that's the one. It should work.
October 20th, 2010 at 10:55 pm
Hi Waldek,
I have provided installation and configuration steps in the Codeplex discussions as it seems a few people have got stuck by not following the correct order. There's also some sample CSS to get people started. :)
I have also successfully rebuilt the project to deploy to the GAC and offered instruction in a related thread.
Thanks very much for a solid solution. I can't believe this was still missing from 2010!
November 29th, 2010 at 4:12 pm
@Waldek, I deployed ECQWP but my contents are only visible in Edit mode and could not figure out why my page is blank in view mode. Could you offer any advice? Thanks.
November 29th, 2010 at 5:07 pm
@Saji: Could it be that you didn't publish/approve the custom XSLT files?
November 29th, 2010 at 5:41 pm
@Waldek Thanks for your response. The XSLT files are published and approved. The "Hidden" is unchecked on the Layout section of the Content Query Tool Part (Modify Shared Web part).Any other thought. Really appreciate it. Thanks.
November 29th, 2010 at 8:03 pm
@Saji: Could you check if any of the out of the box styles displays anything? This might help you determine if there is issue with XSLT or the query.
November 29th, 2010 at 8:15 pm
@Waldek Thanks again. The Out of the Box (OOB) styles are displaying without any problem. I added the OOB CQWP and it displays everything fine. I also observed that the Title of the ECQWP is showing but not the content. Thanks again. I really appreciate your help.
November 29th, 2010 at 9:33 pm
@Saji: Could you try adding <textarea><xsl:copy -of select="."/></textarea> to the root template in ContentQueryMain.xsl to see what the XML response generated by the CQWP is?
November 29th, 2010 at 10:33 pm
@Waldek Thanks again. Pls, where exactly do I add ? The code is kind of intimidating. Heel bedankt. My wife is Dutch, so I know that. Thanks.
November 30th, 2010 at 5:53 am
@Saji: Just add the code I mentioned right below in ContentQueryMain.xsl or your customized version of it.
November 30th, 2010 at 3:50 pm
@Waldek Thanks again. The code did not make nay difference. Do you want me to send you my codes in an email or I should post them. I will be grateful if you can take a look at them.
November 30th, 2010 at 5:13 pm
@Saji: Feel free to send me the code using the contact form, although I cannot promise when I will be able to have a look at it.
When you're saying it didn't make any difference: you should be able to see a textarea with the CQWP XML output in it. If you don't it means that your CQWP doesn't use your XSL at all and there is little point of me having a look at it.
One more thing that you might want to read is the MSDN article on customizing CQWP's XSL (http://msdn.microsoft.com/en-us/library/bb447557.aspx). It might contain some helpful tips.
November 30th, 2010 at 6:42 pm
@Waldek, Thanks for your efforts, really appreciate it.
You are right that the ECQWP doesn't use the ContentQueryMain.xsl.
The enhanced web part comes with its own ECQWPItems.xslt and ECQWPMain.xslt (I believe a customized version of the out of box ItemStyle.xsl and ContentQueryMain.xsl respectively).
I also noticed that both the Out of the box CQWP and ECQWP are using the same Header.xsl and the out of box webpart is displaying correctly in 'View' and 'Edit' mode.
I am wondering what role the ContentQueryMain.xsl plays in all this (if any). Thanks.
November 30th, 2010 at 6:50 pm
@Waldek, Here is the ItemStyle that comes with the Customized CQWP:
_blank
<![CDATA[
Title
Last Modified
]]>
<![CDATA[]]>
November 30th, 2010 at 6:52 pm
@Waldek, The xml was truncated, it did not display properly ( as you can see above). Any other option to get the file across to you?
Thanks.
November 30th, 2010 at 8:09 pm
@Waldek, I found you on msdn forum. have posted the code to the msdn forum at:
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/b2a8ae26-45d1-401d-9518-7f2895670534/#1a9b1d66-2650-4b32-80af-35b80f6e018b
Hope you will find time to look at it. Thanks.
November 30th, 2010 at 9:16 pm
@Waldek, I logged in to SharePoint as another user (other than an Admin) and discovered something even more strange:The web part was visible in 'View' and 'Edit' modes. However, instead of displaying normal files like .xls, .doc, .pdf, the files displayed are .xls, .jpg, and .css
Hope that provides some insight into what might be going on.
Thanks.
November 30th, 2010 at 9:32 pm
@Saji: because the ECQWP uses the customized XSL files you have to add the code I mentioned before to that file, instead the default ContentQueryMain.xsl. As you notiecd, it doesn't play any role whatsoever since the ECQWP uses a customized version of it.
As for the extensions/file type: I don't really see how that would have impact on your issue.
November 30th, 2010 at 10:14 pm
@Waldek. after inserting below in the ECQWPMain.xslt
I got:
.
I don't know what this implies but hope we are getting close to the solution. Thank you very much.
November 30th, 2010 at 10:23 pm
@Waldek. It's like this page is not accepting codes. You can see what I got after adding the code you suggested, here: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/b2a8ae26-45d1-401d-9518-7f2895670534/#1a9b1d66-2650-4b32-80af-35b80f6e018b
December 1st, 2010 at 4:19 pm
@Waldek, Thanks for continuing to help. I don't know how to set both the number of items per page and the page parameter value. This has been a great learning curve for me and I'm still learning. I will appreciate your help to do that. Thanks. http://tinyurl.com/2wk5ks8
December 1st, 2010 at 4:19 pm
@Waldek, Thanks for continuing to help. I don\'t know how to set both the number of items per page and the page parameter value. This has been a great learning curve for me and I\'m still learning. I will appreciate your help to do that. Thanks. http://tinyurl.com/2wk5ks8
December 28th, 2010 at 7:52 am
Hi,
I have a requirement in my Project, where i have to add a Dropdown list for displaying the number of results per page along with the Paging mechanism. Can you please let me know how we can achieve this.
December 28th, 2010 at 9:55 am
@Rahul: At this moment the Extended CQWP doesn't support setting the page size dynamically. What you would need to do for that is to create your own extended version that would accept the page size through a query string parameter. Andrew Connell has a good article about extending the CQWP @ http://www.andrewconnell.com/blog/archive/2008/02/18/Subclassing-the-Content-Query-Web-Part-Adding-Dynamic-Filtering.aspx.
January 12th, 2011 at 12:46 am
Hi Waldek,
THanks for the great post, I have a co-worker who used your code in a site we are creating and everything has installed and appears to be working fine except for one strange occurance, I hope you can help with. When we deploy the ECQWP and the pager everything appears to render fine with the ECQWP displaying the correct number of items and the correct format from the XSLT and the pager renders with the correct number of pages. The problem occurs when a visitor logs into the page, everything renders fine, but when the user clicks on another page the page refreshes with the parameter ?page=2 or whatever page is clicked, but the ECQWP does not go to that page, but instead renders the first page again (which is seems to know it is on based on the nav). There are no errors when this happens and to further confuse matters, if you wait for a couple minutes and click again the page will refresh properly and then work from then on. We thought it might be something timing out, but can find no processes or error in the code. In addition, any users with elevated rights do not experience the issue. Have you seen or heard of anything like this? or do you have any insights that might help? Thanks again, your help is appreciated.
January 12th, 2011 at 7:14 am
@David: Could it be that the page is being cached?
January 12th, 2011 at 5:09 pm
That is what we have been leaning toward, the caching was not configured on the ECQWP so I eanbled it and set it to 30 seconds to see if that might make a difference, it didn't, so we are now exploring the possibility of the Site Output cache, which defaults to a 180 second cache. I was hoping you might have seen this before and could point us to what needed to be changed, I will post the cause once we have it.
January 12th, 2011 at 5:28 pm
Hi Waldek,
We think we found the solution, if you are using Site Collection Output caching, you will need to set the Vary by Query String Parameters to allow the pagination to work properly. This will need to be set to * for the profile that will be performing the actions. Thanks for everything, love the web part.
January 12th, 2011 at 5:34 pm
Just a further note, the reason elevated rights did not see the issue is that in most page output caching profiles 'Allow writers to view cached content' is set to 'No'.
January 12th, 2011 at 6:22 pm
@David McMillan: Now you mention it, it totally makes sense! Thank you very much for going after it and posting back the solution, I really appreciate it! Great stuff!
January 12th, 2011 at 7:44 pm
Just following up on Dave's comment as I work with him. A blog entry about the solution is up on my blog over at http://blog.mandrakeindustries.com/2011/01/12/extended-content-query-pager-not-paging-properly/
January 14th, 2011 at 7:33 am
@Jeff: Excellent! Thank you :D
January 19th, 2011 at 6:32 am
[...] http://blog.mastykarz.nl/paging-content-query-web-part/http://blog.mastykarz.nl/paging-content-query-web-part-how-i-did-it-part-1-inside-the-cqwp/ [...]
June 24th, 2011 at 12:24 pm
Hi Waldek,
Is there a way we can implement paging in CQWP using XSL? Just like we can introduce paging in Data view webpart or List view webpart using XSL.
Thanx in advance.
Vaibhav
June 28th, 2011 at 6:05 am
@Vaibhav: Not that I know of.
August 26th, 2011 at 1:46 pm
How about combining the two webparts, filtering and paging? I am trying to do this but i need some guidance…
August 26th, 2011 at 6:01 pm
@Joana: Paging takes place after retrieving the results so the only thing that you have to take care of is the filtering.
August 29th, 2011 at 9:16 am
Combining the two, i can filter the page but when i change the page to view more results the filter desappear…
August 29th, 2011 at 4:56 pm
The problem seems to be in the link in the number of the page. Because the filter is made by querystring like ?Filter1Field=Name&FilterValue=joana, when we click in the page only appears ?page=2 and we need ?Filter1Field=Name&FilterValue=joana&page=2…Some suggestions?
August 31st, 2011 at 6:12 pm
Can I add & to the xsl to add more than one parameter in querystring? Give me XSLT error.
August 31st, 2011 at 9:06 pm
@Joana: You should be able to do it by encoding the &.
January 7th, 2012 at 8:44 pm
[...] Paging Content Query Web Part Paging Content Query Web Part – How I did it – Part 1: Inside the CQWP SharePoint 2010 Content Query Web Part with paging [...]
January 26th, 2012 at 4:02 pm
Hi Waldek,
I've deployed the wsp successfully and activated the webparts. I can also see the 2 webparts in the webpart gallery, but when I try to add either to the page I get:
"An error occurred while attempting to add the item to the page".
Where am I going wrong? I have Sharepoint 2010.
January 27th, 2012 at 2:56 pm
@Chris: hard to say without more detailed information. I suggest you either disable custom errors or take a look in ULS to get some more information.
January 27th, 2012 at 3:48 pm
Hi Waldek,
Looking through the error logs for:
Correlation ID:a5bc6824-e077-4189-8e47-ee9da6bf1169
The following seem to be relevant:
Error while executing web part: System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed. at Microsoft.SharePoint.SPSite..ctor(Guid id, SPUrlZone zone, SPUserToken userToken) at Microsoft.SharePoint.Publishing.CachedObjectFactory.get_SuperUserSite() at Microsoft.SharePoint.Publishing.CachedArea.GetCrossListQueryResults(SPSiteDataQuery query, SPWeb currentContext, Boolean onlyPopulateCache, Boolean useSpQueryOnList, Int32 lcid) at Microsoft.SharePoint.Publishing.CrossListQueryCache.GetSiteDataResults(CachedArea cachedArea, SPWeb web, SPSiteDataQuery query, Boolean useSpQueryOnList) at Microsoft.SharePo… a5bc6824-e077-4189-8e47-ee9da6bf1169
AND
The action that failed was: Demand The type of the first permission that failed was: Microsoft.SharePoint.Security.SharePointPermission The Zone of the assembly that failed was: MyComputer a5bc6824-e077-4189-8e47-ee9da6bf1169
I've changed the trust level to Medium in the following web.config files:
C:\inetpub\wwwroot\wss\VirtualDirectories\80
C:\inetpub\wwwroot\wss\VirtualDirectories\29359
Any help would be much appreciated :)
Chris
February 6th, 2012 at 5:56 pm
Hi Waldek,
I've resolved the issue. I was using the old 2 part web part. I've installed v14 instead and that works a treat! Excellent work :)
One question though. I have the rss feed for the CQWP but this doesn't take into account the paging. is there a way to output the RSS of what is actually on the screen i.e. adhere to the paging.
Thanks again
Chris