SharePoint 2010 Content Query Web Part with paging

, , ,

Imtech Content Query Web Part with paging enabled One of the coolest and probably most frequently used Web Parts in SharePoint 2007 was the Content Query Web Part (CQWP) – a great control that allowed you to display content aggregations to the users. Although it was pretty awesome, it had some serious drawbacks like for example the lack of a paging mechanism – something that almost every single Web Content Management project that I worked on required. Three years later in SharePoint 2010 the CQWP got a facelift and shipped with some seriously cool features like slots and the Content to Content concept. Unfortunately still no sign of paging. So what if you want to create an aggregation of your content and page the contents? Do you have to create a custom and bad performing Web Part? Not really… Introducing Imtech Content Query Web Part v14!

Custom properties of the Imtech Content Query Web Part that provide support for paging Imtech Content Query Web Part is the solution for the lack of paging in the standard Content Query Web Part. Using the options in the properties of the Web Part, you can specify how many items you want to display per page and what the name of the query string parameter is, that holds the number of the page. So how it works?

The first thing that you need to do is to set the Page Size. By default it is set to 0 which means, that paging is disabled. The other thing that you have to do is to modify the XSL so that the Content Query Web Part becomes aware of paging and will be able to display the paging controls.

Powered by XSL

The support for paging in Content Query Web Part requires changes to two XSL files used by the CQWP: the ContentQueryMain.xsl and ItemStyle.xsl. The first configures the parameters and passes information to the Item Templates that is required in order to display the paging controls. The ItemStyle.xsl is responsible for displaying the pager control. Depending on your scenario you might either want to create a different paging control for every template or create a single one and reuse it across all templates.

To see it all working you can download the examples of the XSL files that enable paging. Simply upload them to your Site Collection and change the links in the properties of the Imtech Content Query Web Part.

Imtech Content Query Web Part Feature

Imtech Content Query Web Part is a free Web Part and you can use it without any restrictions. Please note, that it is not supported by Microsoft and you use it at your own risk.

Download: ImtechContentQueryWebPart.wsp (7KB, WSP)
Download: ImtechContentQueryMain.xsl (19KB, XSL)
Download: ImtechItemStyle.xsl (32KB, XSL)

And if you are interested how it all really works stay tuned for the Imtech Content Query Web Part How they do it article!


Possibly related posts

104 Responses to “SharePoint 2010 Content Query Web Part with paging”

  1. David Says:

    Hi Waldek,

    Have you experienced some issue while extending SharePoint Content Query Web Part ? When i try to extend ContentQueryWebPart with a kind of NewsContentQueryWebPart, SharePoint says he can't import the webpart… the same wsp works fine with SharePoint 2010 RC. SafeControls, Gac deployment, full trust … i think there is some issue with beta 2.

  2. Waldek Mastykarz Says:

    @David: Have you used the SharePoint Web Part Project Template to create the extended CQWP? If so, there was an issue indeed with an assembly attribute. Although I don't know the exact name anymore, you can find it at the bottom of your assembly properties file. Removing the attribute should fix your issue.

  3. SharePoint 2010: Recopilatorio de enlaces interesantes (V)! « Pasión por la tecnología… Says:

    [...] SharePoint 2010 Content Query Web Part with paging [...]

  4. Rene Says:

    I can not use your Webpart on SharePoint 2010 Foundation Beta2.
    I get an UnsafeControlException (Control can not show or import. Type not found or not secure…)

  5. Rene Says:

    Hi, I can not use your Webpart on SharePoint 2010 Foundation Beta2.
    I get an UnsafeControlException (Control can not show or import. Type not found or not secure…)

  6. Waldek Mastykarz Says:

    @Rene: Content Query Web Part ships as a part of SharePoint Server 2010. You cannot use it with SharePoint Foundation 2010 unfortunately.

  7. JK Says:

    Hi,
    I added a Imtech CQWP on a page in SP2010. It works fine but after editing this page in SPD2010 in advanced mode. This web part shows error. It says "Web Part Error: An unexpected error has occurred"
    Has anyone experienced this problem before?
    any solution?

  8. Nilay Parikh Says:

    Hi, Thanks for the job, really nice stuff,

    is the web part work with SharePoint Foundataion 2010? I am trying to deploy it on Foundation 2010 but not able to activate the solution.

    Any suggestion???

  9. Binu Says:

    Thanks for another great post Waldek,
    Its really pleasure to read your blogs..
    I am also trying to extend the CQWP in SP 2007, Can you please share the code for this WSP with me. It would be very helpful for me….

    Thanks in advance..

  10. Waldek Mastykarz Says:

    @JK: Have you checked the ULS logs for more details on the exception?

  11. Waldek Mastykarz Says:

    @Nilay: CQWP works only on SharePoint Server 2010.

  12. Waldek Mastykarz Says:

    @Binu: Thank you for your feedback, I really appreciate it. As for the source code, I unfortunately cannot share it with you as it belongs to my previous employer. What you could do though, is to download the WSP and open the assembly using reflector so that you can see what changes I have made.

  13. Keith Hamilton Says:

    I love your explanations for WSP – especially your analysis/explanations of Content Query Web Parts with Slots. Here's a situation I'm having that I hope you've either seen, or can help me with:

    In our environment, we want to expand the list of columns in a custom item style by four. We want this to apply to all queries, so we've modified the ItemStyles.xsl file to include 4 "CustomColumn"n fields, in a "CustomColumns" item style. The user/administrator should be able to type the column name in the CustomColumn textbox and have that column rendered. That works fine.

    Here's the problem: when the information is rendered, some columns need formatting (Due Date, Priority, etc.). As the columns are not known ahead of time and we want the ItemStyles.xsl file to apply universally, how do I apply formatting?

    I'm hoping you can help. Thanks in advance.

  14. Waldek Mastykarz Says:

    @Keith: I would say that you need to approach it from the semantic point of view. What kind of information do you want to present? Is it an overview of events with locations, times and tickets' prices or overview of press releases, with the date and the author. Only such approach will allow you to format the data according to its type. The idea of having a generic template is okay, but unfortunately limits the ability of formatting the data. You could of course extend the CQWP and create a custom XSLT function, which would allow you to retrieve the data type for each field, but it would have a big performance impact on your solution.

  15. Keith Hamilton Says:

    Thanks for the information. I am indeed attempting to extend the CQWP, though it's not clear to me how I am supposed to (or if it's even possible to) format the data before it is rendered. Fortunately, in this instance, performance isn't terribly critical. I was hoping for some direction, or that you may have seen/done something similar in the past. I appreciate your time regardless.

  16. Waldek Mastykarz Says:

    @Keith: as I said, I would definitely stick with different templates for different types of data. Otherwise you have the risk of it getting really complex. Your custom rendering would have to deal with all out of the box value types plus some custom ones that might be created in the future.

  17. Keith Hamilton Says:

    Thanks for the advice, Waldek. Given your comments and the issues we were already having, we decided that formatting could be handled in custom columns – columns that would then be accessed by the CQWP. Like you said – it was much too difficult to format through the web part and/or an XSLT function.

    What I'm finding now is that I'm having a deployment problem. Once I was satisfied that I could get the slots working correctly, I copied the ItemStyles.xsl to a CustomItemStyles.xsl file and returned the ItemStyles.xsl to its original form (I was editting it in Sharepoint Designer). We decided to deploy this as a Feature, so we created a module for custom web parts and added the custom content query files, to include the Elements.xml, SharepointProjectItem.spdata file, the content query extension cs file, the webpart file and a folder with the xsl files in it (CustomContentQueryMain.xsl and CustomItemStyles.xsl). My understanding is that the webpart file will specify the properties for the web part, so the property entries here are where the xsl file will reside:

    CustomContentQueryWebPart
    Custom Content Query Web Part
    /Style Library/XSL Style Sheets/CustomItemStyles.xsl

    The problem is that when I deploy, activate and try to add this webpart, I get the message:
    The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced.

    When I look in All Files on the server (through Sharepoint Designer), and navigate to the /Style Library/XSL Style Sheets folder, I don't see CustomItemStyles.xsl there – obviously.

    Should it be there? Do you know what I'm missing?

    Thanks in advance.

  18. Keith Hamilton Says:

    Thanks for the advice, Waldek. Given your comments and the issues we were already having, we decided that formatting could be handled in custom columns – columns that would then be accessed by the CQWP. Like you said – it was much too difficult to format through the web part and/or an XSLT function.

    What I\'m finding now is that I\'m having a deployment problem. Once I was satisfied that I could get the slots working correctly, I copied the ItemStyles.xsl to a CustomItemStyles.xsl file and returned the ItemStyles.xsl to its original form (I was editting it in Sharepoint Designer). We decided to deploy this as a Feature, so we created a module for custom web parts and added the custom content query files, to include the Elements.xml, SharepointProjectItem.spdata file, the content query extension cs file, the webpart file and a folder with the xsl files in it (CustomContentQueryMain.xsl and CustomItemStyles.xsl). My understanding is that the webpart file will specify the properties for the web part, so the property entries here are where the xsl file will reside:

    <data>
    <properties>
    <property name=\"Title\" type=\"string\">CustomContentQueryWebPart</property>
    <property name=\"Description\" type=\"string\">Custom Content Query Web Part</property>
    <property name=\"ItemXslLink\" type=\"string\">/Style Library/XSL Style Sheets/CustomItemStyles.xsl</property>
    </properties>
    </data>

    The problem is that when I deploy, activate and try to add this webpart, I get the message:
    The web part references an untrusted XSL file. Only XSL files contained in this site\'s Style Library may be referenced.

    When I look in All Files on the server (through Sharepoint Designer), and navigate to the /Style Library/XSL Style Sheets folder, I don\'t see CustomItemStyles.xsl there – obviously.

    Should it be there? Do you know what I\'m missing?

    Thanks in advance.

  19. Waldek Mastykarz Says:

    @Keith: I'd say you should create a separate Module for the XSLT and provision it separately from the Web Part which can be added directly to the Feature without being wrapped in a Module. Adding the XSLT file using a folder within the Web Part SPI would provision it to the Web Part Gallery instead of to the Style Library.

  20. Keith Hamilton Says:

    We were able to get around the deployment issue by updating the module node in the Elements.xml to designate where the XSL file should go (namely, to the /Style Library/StyleSheets folder) and setting the File node Type to GhostableInLibrary.

    I could see it and open it for edit in SP Designer, but I still get the following error when I try to access it through the CQWP:

    "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced."

    After exhausting several methods to fix this situation, we decided that we'd take an even closer look at your IMtech CQWP, so we imported it to our environment. We then attempted to use your CQWP to open our ItemStyles.xsl. That threw the same error message. We even tried pushing your ItemStyles.xsl to that location and got the same error.

    Do you know how to fix this error, or know of an alternative for deploying/accessing an xsl file?

    As always – your input is greatly appreciated.

  21. Keith Hamilton Says:

    We were able to get around the deployment issue by updating the module node in the Elements.xml to designate where the XSL file should go (namely, to the /Style Library/StyleSheets folder) and setting the File node Type to GhostableInLibrary.

    I could see it and open it for edit in SP Designer, but I still get the following error when I try to access it through the CQWP:

    \"The web part references an untrusted XSL file. Only XSL files contained in this site\'s Style Library may be referenced.\"

    After exhausting several methods to fix this situation, we decided that we\'d take an even closer look at your IMtech CQWP, so we imported it to our environment. We then attempted to use your CQWP to open our ItemStyles.xsl. That threw the same error message. We even tried pushing your ItemStyles.xsl to that location and got the same error.

    Do you know how to fix this error, or know of an alternative for deploying/accessing an xsl file?

    As always – your input is greatly appreciated.

  22. Waldek Mastykarz Says:

    @Keith: I haven't really tried deploying the CQWP XSL files to location other than the Style Library. Are you saying that you're getting the error even when deploying the XSL files to Style Library? Could you post the exact repro steps so that I can see if I'm getting the same error or if it's something specific to your site?

  23. Keith Hamilton Says:

    Sorry for being so vague – and also for not specifying the exact path. We're deploying the XSL files to the "/Style Library/XSL Style Sheets" folder, which is the default location for the CQWP XSL files. When I began experimenting with CQWP Slots, I modified the ItemStyles.xsl in this folder. Everything worked great. Unfortunately, despite deploying the CustomItemStyles.xsl file to the same folder, I am unable to access it through WSP – even though I can see and modify it through Designer in that location.

    Here are the steps I follow:
    1. Create a module in a WSP Solution.
    2. Add the CustomItemStyle.xsl (which is a copy of the IMTechItemStyle.xsl) to the module.
    3. Be sure that the Elements.xml file in the module includes the following:

    4. Create a feature in the Solution that includes the module just created.
    5. Deploy the solution.
    6. Verify through Designer that the file has been pushed and/or updated.
    7. Add the IMTech CQWP to a page.
    8. Go through the standard CQWP setup operations.
    9. In the IMTech CQWP section of the web part, enter the location of the Item XSL Link textbox as "/Style Library/XSL Style Sheets/CustomItemStyles.xsl".
    10. Hit the Apply button

    At this point I get one of two messages – sometimes I get a Server Error with "Could not load XSL file" and other times I get a trapped error in the CQWP that says "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced".

    Please let me know if you need more information, or if something's not clear.

    Thanks.

  24. Keith Hamilton Says:

    The xml was cut out of step 3, but it's basically as follows:

    Within the Elements.xml file, in the Elements node,
    a Module node with Name="CustomStyles" Url="Style Library/XSL Style Sheets", with a File child node containing Path="CustomStyles\CustomItemStyles.xsl" Url="CustomItemStyles.xsl" and Type="GhostableInLibrary"

    I hope that helps.

  25. Keith Hamilton Says:

    I've stepped away from this project a few days to concentrate on other things, but I'm coming back to it today. As a relative Sharepoint newbie, I conceed that my reproduction steps might not make a lot of sense – technically and/or semantically. For that I apologize. I've pieced together steps I've read from different sources.

    Anyway, I'm still getting the same error, which I've found out MIGHT mean that the custom CQWP may not be able to resolve the CustomItemStyles.xsl path, and may not have anything to do with the file being "untrusted", as the message implies.

    Is it possible for you to post your deployment steps, so I can compare your procedure to what I'm doing?

    It would be much appreciated.

  26. Waldek Mastykarz Says:

    @Keith: the deployment steps are just as if it was a general WSP:
    1) Install the WSP
    2) Deploy it
    3) Go to the Site Collection and activate the Site Collection Feature to install the CQWP in the Web Parts Gallery
    4) Voilla! You're done and you can start using the CQWP with paging.

    If you need custom XSLT you can upload them to Style Library. Don't forget to Publish and Approve them. Although if you've tweaked something about the permissions, you might want to double check if everyone can access the XSLT files. Otherwise the Web Part might fail to work for some users.
    Hope that helps.

  27. share Says:

    i have deployed Content Query Webpart With paging, while i am trying to add this webpart to the page its givig me error" Can not import this webpart" , pls help me this is urgent .

  28. Waldek Mastykarz Says:

    @share: have you read previous comments to see if anything there could help you?

  29. Marcus Lundén Says:

    I'm trying to add imtech web part to a page ( Sharepoint 2010 ) but I get a warning "Can not import this web part".

    Any proposal for solution?

  30. Waldek Mastykarz Says:

    @Marcus: have you read previous comments in order to verify of none of them describes the same issue/solution as you have?

  31. parveen Says:

    we are getting the paging only left top corner. but we need the paging bottom right corner. How to apply this XSLT. we tried the below URL also . it's not work . Please give me soluation .

    http://jassimkhan.blogspot.com/2010/05/imtech-content-query-web-part-paging-on.html

  32. Waldek Mastykarz Says:

    @parveen: Are you sure that the CQWP is linked to your custom XSLT?

  33. parveen Says:

    @Waldek Mastykarz :we down load the webpart and xsl file from from same site proveded by u ,only problem v r facing is "pagind is not coming at bottom left corner".The paging is working fine in top corner left side.We want both top and bottom corner left side.

  34. Mohammad Says:

    Peace,

    This is really genuine and that's what i call masterwork, thanks alot, but i have a question how do you get the paging control displayed right under the items? as i have it displayed on the top, i tried so many times and it just came under the first item only.

    Please advise
    Thank you in advance

  35. Robert Says:

    I love your webpart, the paging is awesome… There is one problem I found with it. It seems the display slots are not working (not updating) when I change which item template to use. I can work around this using display fields but it's pretty annoying to find the names and types for each field. Am I the only one with that issue?

  36. Waldek Mastykarz Says:

    @Mohammad: <xsl:if test="$CurPos = $LastPos">…paging…</xsl:if>

  37. Waldek Mastykarz Says:

    @Robert: You mean when changing the Item Style or the XSLT?

  38. Robert Says:

    I found the problem…

    It seems there is a bug with SharePoint / IE / CQWP, not with your webpart. Once in a while, if you change the Item XSL link and click apply. After, if you go and change the applied Item style and change it, the Display slots in the toolpart won't update to reflect the style you selected. It won't even update if you click ok, reload the page then try to reedit the webpart. The workaround I found was to open the page in firefox and edit the webpart. That seems to fix the bugged cache or something.

    Hope this helps someone…

  39. Waldek Mastykarz Says:

    @Robert: I wouldn't say it's a bug. It's by design: the available slots are being retrieved and stored in the Web Part while loading the Web Part. After changing the XSLT (something that isn't possible out of the box), the CQWP doesn't refresh slots, meaning that in order for you to see the slots from the new XSLT file, you have to click the OK button and then edit the Web Part properties again. It's just the way things have been designed.

  40. Rajesh Says:

    My requirement is to display the contents from the list which has more than 500 items, but the pagination must be there for top 50 submitted times. I tried to set the "limit the number of items" to 50. but it didn't work.

  41. Waldek Mastykarz Says:

    @Rajesh: CQWP doesn't natively support paging. If you configure Row Limit it will retrieve no more than that many items. Unfortunately there is nothing you can do about it.

  42. Mohammad Says:

    Happy New Year, Thank you for your kind response, i've tried this:

    but it didn't work, any idea ?

  43. Mohammad Says:

    Peace,

    i figured out how to do it, it's all good now, thank you.

    i've added the variables first, as shown below (hope the code will be displayed)

    and then i did what you told me to do

    Thanks a mill..

    but i have one last thing, if it could happen then it would be perfectness at its finest, i'm going to try to add 2 more links in the paging control (last page and first page), full option control.

  44. Mohammad Says:

    Peace,

    i figured out how to do it, it\'s all good now, thank you.

    i\'ve added the variables first, as shown below (hope the code will be displayed)

    <xsl:variable name=\"Rows\" select=\"/dsQueryResponse/Rows/Row\" />
    <xsl:variable name=\"RowCount\" select=\"count($Rows)\" />
    <xsl:variable name=\"LastPos\">
    <xsl:value-of select=\"$RowCount\" disable-output-escaping=\"yes\"></xsl:value-of>
    </xsl:variable>

    and then i did what you told me to do

    <xsl:if test=\"$CurPos = $LastPos\">…

    Thanks a mill..

    but i have one last thing, if it could happen then it would be perfectness at its finest, i\'m going to try to add 2 more links in the paging control for last page and first page, that's got be a full option paging control.

    Thank you again, wish you all the best and more success

  45. jriesen Says:

    I knew how to get this to work in MOSS 2007. I added a template to the XSL item stylesheet. This doesn't seem to work now in SP2010.

    When I add "DocIcon" to the Field to Display: Image textbox it changes to "Type [Base Columns]" and not sure how to accommodate this with the XSL code (see template code below).

    So then I was thinking I could try adding "DocIcon" to the Imtech "Common View Fields" textbox, but did not produce any results.

    I would think this is a commonly wanted feature for CQWPs that display from document librairies.

    Let me know if you can help.

    ======================

    _blank

    ==================

    Not my XSL code. Originates from http://edinkapic.blogspot.com/2007/09/document-icon-in-cqwp.html

    Left a copy of this comment on the codeplex discussion page, as well

  46. Waldek Mastykarz Says:

    @jriesen: did you check in the resulting XML if the DocIcon is being retrieved at all? Something's telling me it doesn't work if you crawl over multiple lists/sites.

  47. LavSP Says:

    Hi Waldek! And thank you for a great webpart!
    My question is about showing the paging control under the items. I have tried the solution Mohammad described, but the paging control appears only in the last page if the page size is set to 5 and there are 20 element for example. Do you have any tips of how I can resolve that?

  48. Waldek Mastykarz Says:

    @LavSP: the $CurPos = $LastPos should work. Have you checked what the values of those variables are for each record?

  49. LavSP Says:

    Waldek: I`m not sure how to do that?

  50. Waldek Mastykarz Says:

    @LavSP: you can add <xsl:value -of select="$CurPos"/> in your template.

  51. LavSP Says:

    Thank you for quick answer, Waldek!
    Somehow I`m doing something wrong, because when I run the test <xsl:if test="$CurPos = $LastPos"> the paging doesn`t show at all. Can you update your ImtechItemStyle.xsl file to show the paging both on top and at the buttom as your screenshot shows?
    Anyway, thank for your help so far, and have a nice weekend!

  52. Waldek Mastykarz Says:

    @LavSP: the <xsl:if test="$CurPos = $LastPos"> is exactly the check that I'm using myself so it should be working. Have you checked the values of the CurPos and LastPos variables as I asked before?

  53. LavSP Says:

    I did some testing by just adding a div with some text after the if text, and its actually showing it correct after the last element :) But it does not show anything when I try with the paging controls.
    This is what I`m putting in after the if test:
    "

    "
    Once again, thank you for taking time to answer all my questions and have a nice day!

  54. Waldek Mastykarz Says:

    @LavSP: seems like the XSLT has been trimmed. Could you try to post it again? If it won't work you could try to use the contact form in the about section as well.

  55. LavSP Says:

    Her is the code again:

  56. LavSP Says:

    xsl:if test="$CurPos = $LastPos"
    xsl:if test="$CurPos = 1 "
    xsl:if test="$CurPos = 1 and $PageSize > 0"
    xsl:variable name="NumPages" select="ceiling($TotalRecords div $PageSize)"/
    xsl:if test="$NumPages > 1"
    div
    xsl:call-template name="PagingControls"
    xsl:with-param name="Page" select="1" /
    xsl:with-param name="NumPages" select="$NumPages" /
    /xsl:call-template
    /div
    /xsl:if
    /xsl:if
    /xsl:if
    /xsl:if

  57. Mark Says:

    I have installed your webpart and have got it semi-working. I can add the web part and can get it to restrict the number of items show to the number i put into page size. However I cant get the page change options (i.e. page number and next page). Im guessing its to do with the style sheets/templates. What is the exact address of the Style Library/XSL Style Sheets/ that you put into ITEM XSL link and Main Xsl link? Also, you say

    'To see it all working you can download the examples of the XSL files that enable paging. Simply upload them to your Site Collection and change the links in the properties of the Imtech Content Query Web Part.'

    How do you change the properties? Is this in the web part section of the site collections settings?

    Thanks for any help you can give.

    Mark

    p.s. Great web part though!

  58. Waldek Mastykarz Says:

    @Mark: The URLs would be something like '/Style Library/XSL Style Sheets/YourItemStyle.xsl' and '/Style Library/XSL Style Sheets/YourContentQueryMain.xsl'. Please note that it depends on where in the Style Library you deployed your custom files to. If you have deployed them to a folder you have to include it in the URL as well. Probably the easiest way to get a proper URL is to open the XSL file in the browser, copy the URL and then strip everything before the first /.

    The XSLT URL can be changed through the Web Part Properties pane as shown in the article above.

  59. Ryan Says:

    Hi Waldek,
    This webpart sounds very promising. I was able to install the webpart on our SharePoint 2010 environment, add the web part to a page, copy the 2 xsl files to the "Style Library/XSL Style Sheets" directory, configure the page size and xsl file locations respectively, and the webpart does return results. However, the paging control is no where to be seen. I'm using your default xsl files, am i missing something?

    Thanks,
    Ryan

  60. Ryan Says:

    Hi Waldek,
    Great post and this is the perfect solution for me. Unfortunately, i'm having problems getting the paging section of the webpart to work. I was able to install the wsp, activate the feature, add the xsl to '/style library/style sheets/' directory, add the webpart to a page and edit the webpart. i do see the section to configure the imtech to input 'page size' and 'xsl link' settings. The result is, the webpart lists the right amount of content based on the page size, but it doesnt have the paging links to the next pages (1 2 3 4…). I'm using the sample xsl files provided from the download site http://imtech.codeplex.com/releases/view/39782. Am i missing something?

    Thanks,
    Ryan

  61. Waldek Mastykarz Says:

    @Ryan: Which Item Style are you using? If you're using those sample files, the Paging control is enabled only for the default template.

  62. Ryan Says:

    Hi Waldek,
    I'm using the sample item style. when you say default template, what are you referring to? is this the master page? I haven't customized anything so far.

    thanks,
    Ryan

  63. Waldek Mastykarz Says:

    @Ryan: I mean the Item Style that you can configure in the CQWP.

  64. Ryan Says:

    Hi Waldek,
    Everything i'm using is default, i havent customized anything. As for the item styles, i'm using the two xsl files you've provided as samples. The webpart displays content just fine, it just doesnt display the page control where i'd usually able to select 1, 2, 3, 4…

    Thanks for your response. I really appreciate it!
    Ryan

  65. Waldek Mastykarz Says:

    @Ryan: have you configured the page size in the CQWP properties?

  66. Ryan Says:

    Hi Waldek,
    yes I set it to 10 just like your screenshot.
    Ryan

  67. Daron Says:

    I seem to have successfully deployed the solution however I don't see it as a feature to activate. Do you happen to have steps to install the wsp so that I can make sure that I've done that part correctly.

  68. Waldek Mastykarz Says:

    @Daron: Have you looked under Site Collection Features? The CQWP Feature should be listed there.

  69. Lallo Says:

    We're trying to upgrade from 2007 to 2010 and I'm getting a Security Exception error after installing the extenedcqwp. I was wondering if you know of anyone else ran into this error. Also, the webpart worked wonders for us in 2007!

  70. Waldek Mastykarz Says:

    @Lallo: I haven't really run into that issue. The assembly is being deployed to the GAC so in theory you shouldn't have any Security Exceptions. Have you checked the stack trace of your exception to find out which method exactly is causing the exception?

  71. Lallo Says:

    Thanks, Waldek! I deployed it to the GAC, but I'm still getting the Security Exception. Here is the error:

    [SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.]
    Imtech.SharePoint.WebParts.ExtendedContentQueryWebPartPager.RenderContents(HtmlTextWriter writer) +0
    System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +42
    Microsoft.SharePoint.WebPartPages.WebPart.RenderWebPart(HtmlTextWriter output) +10
    Microsoft.SharePoint.WebPartPages.WebPart.Render(HtmlTextWriter writer) +155
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +11042100
    Microsoft.SharePoint.WebPartPages.SPChrome.RenderPartContents(HtmlTextWriter output, WebPart part) +43

  72. David Says:

    Hi Waldek,
    first congrats for your work :)

    I've installed it and it's working quite fine, but i've found a few issues, wow can I place the paging controls below the results?

    Thanks.

    David.

  73. Waldek Mastykarz Says:

    @David: Thank you, I appreciate the feedback. You can change the position of the pager by editing the XSLT.

  74. Ben Says:

    Hi there Waldek,

    would you know of a way to use the Paging feature only against an existing SharePoint List or Document Library? wihout using the Content Query? using your Extended Content Query webpart is great but i loose some of the existing view functionality out of the box with sharepoint (create new docs, upload docs).

    thanks

    Ben

  75. Waldek Mastykarz Says:

    @Ben: You mean like using a List View Web Part with a Paged View?

  76. Ben Says:

    @Waldek,

    yes thats exactly right?

    thanks

    Ben

  77. Waldek Mastykarz Says:

    @Ben: So why not use the List View Web Part in the first place?

  78. Ben Says:

    @Waldek

    only because the default list view webpart doesn't support paging or external connections to enable the pager to read from it. i hope thats clearer?

    is there an email address i can email a screenshot to you by any chance?

    thanks for your time and i hope that makes more sense

    Ben

  79. David Says:

    Hi Waldek,
    although I've tried modifying XSL to move Paging Controls, I can't get what I expect. I mean, I do modify DEFAULT template from ImtechItemStyle.xsl and I moved the piece when NumPages are tested from the beginning of template definition, to the end.

    And now paging controls are shown just on second place occurrence of CQWP although there are more occurrences.

    I was:

    1 2 3 4 5>
    Item 1
    Item 2

    Item N

    And now I get:

    Item 1
    1 2 3 4 5 >
    Item 2

    Item N

    What I'm doing wrong?

    Thanx in advance.

  80. Andrew Says:

    So, if I understand right, paging will work only in limits set in "Limit the number of items to display" field of the original CQWP settings, right?
    i.e. if I set a limit to 100 and page size to 10 the webpart will show only 10 pages.

    So, if I want to display paged items from a library with more then 100000 items, I have to uncheck "limit" checkbox and in this case request will be rejected because it exceeds the list view threshold, right?

  81. ZEMZEMI Says:

    Hi,
    Thank you for your great WebPart !
    I have some questions and I hope that you could help me:
    I created my custom template in _ItemStyle.xsl and I wanted to add Paging to this template. But,When I entered properties paging in the WebPart I didn't get this feature. How can I do ?

    Best regards

  82. Waldek Mastykarz Says:

    @Andrew: Yes, you're right.

  83. Waldek Mastykarz Says:

    @ZEMZEMI: Are you sure that the CQWP isn't using the previously cached XSLT without your paging settings in it?

  84. Content Query Web Part with paging in SharePoint - Websphere Tutorial Says:

    [...] Here is a good tutorial show you how to use Content Query Web Part with paging in SharePoint: One of the coolest and probably most frequently used Web Parts in SharePoint 2007 was the Content Query Web Part (CQWP) – a great control that allowed you to display content aggregations to the users. Although it was pretty awesome, it had some serious drawbacks like for example the lack of a paging mechanism – something that almost every single Web Content Management project that I worked on required. Three years later in SharePoint 2010 the CQWP got a facelift and shipped with some seriously cool features like slots and the Content to Content concept. Filed in SharePoint with 0 Comments « Trick Sharepoint Query String [...]

  85. ayala Says:

    Is it based on Ajax?
    i'm looking for cqwp based on ajax…

  86. Waldek Mastykarz Says:

    @ayala: Unfortunately the CQWP doesn't support AJAX out of the box. If you need AJAX I think it would be easier for you to create a custom Web Part rather than using the CQWP.

  87. Imtech Content Query Web Part for SharePoint 2010 « Geoff Varosky's Blog Says:

    [...] a client request to add some paging into the Content Query Web Part, and stumbled upon Waldek’s Imtech Content Query Web Part for SharePoint 2010. This was the perfect solution for my client, but I needed to make a few modifications… this post [...]

  88. Geoff Varosky Says:

    I put together a blog post about retro-fitting existing stylesheets for use with the Imtech CQWP to support paging, as well as a few others changes made along the way (moving paging controls to the bottom), as well as overcoming a few issues.

    Hopefully this can be helpful to others!
    http://go.gvaro.net/nVb5KW

  89. Chris Pettigrew Says:

    Hi Waldek, This paging control as great. However is it possible for you to write a tutorial on how to use pagination with SPQuery and SPListItemCOllectionPosition. I am trying to figure it all out and i know there are alot of people who would love to see how it is done.

    Thanks for all the work !

  90. Waldek Mastykarz Says:

    @Chris: great idea! I will definitely add it to my writing list. Thank you for the feedback, much appreciated :)

  91. Jack Says:

    Hi Waldek

    I try to use your web part. But always when I apply the settings it loses the path to "ImtechContentQueryMain.xsl" or sometimes "ImtechItemStyle.xsl" and I get the following error (translated from german):

    "The Web refers to an untrusted XSL file. Referrals may be available only to XSL files that contained in this site are the style library."

    One times it worked, but I don't know why.
    Could you tell me why this might happen?

    Regards,
    Jack

  92. Waldek Mastykarz Says:

    @Jack: XSL files used by the CQWP must be deployed to the Style Library. Could it be that you have deployed your files elsewhere?

  93. Jack Says:

    Hi Waldek

    I found the solution. I inserted the path like this: "Style Library/XSL Style Sheets/ImtechContentQueryMain.xsl". In the path it has to be a slas first.
    With "/Style Library/XSL Style Sheets/ImtechContentQueryMain.xsl" it works.

    Now I try the Lists Override. What is the syntax for this? Do you have an example? I Tried the followind syntax:

    and

    I always get the following error:

    "This Web Part can not be displayed. Open this website in a format compatible with Microsoft Windows SharePoint Services HTML editor such as Microsoft SharePoint Designer to handle this problem. If the problem persists, contact your Web server administrator."

    Do you have a documentation for your webpart? Do you have skype? We can solve the problems over skype.

  94. Chris Renaud Says:

    **** To resolve the paging at the bottom issue ****

    Just to make things clear.. it took me awhile to sort this out with all the comments. Edit the ImtechItemStyle.xsl file. Go into the node add the following into the variables at the top

    (Thanks Mohammad btw)

    Change the following line:

    to

    - Save the file to /style library/xsl style sheets
    - Reference the file within the webpart

    and that's it!! (remove all the backslashes btw \)

    Good Luck and I hope this clears things up for everyone.

  95. Yin Says:

    Hi, Waldek

    Thanks for your sharing. I used your webpart in my publishing site. But for some reason, the anonymous user sometimes can not switch between the pages while the login user never has problems. Any ideas on what could be the possible reason?

    Another thing is, if I put two webparts on a same page, the page control is not independent. I believe it is because they all read the same page number from the url. What could be done to avoid this please?

    Thanks in advance!

  96. Waldek Mastykarz Says:

    @Yin: Could it be that you're using OutputCache and you haven't added the paging parameter to the 'Vary by query string parameter' setting in the your cache profile?

    As for multiple Web Parts on the same page, in CQWP's properties you can configure which query string parameter that you want to use. Simply change 'p' to something else for the second CQWP and you should be all good.

  97. Yin Says:

    Thanks a lot Waldek! That's exactly the reason.
    Problem solved.

  98. Dean Says:

    I have a long list that i want to group and then display in several columns. Currently, one of my columns is much longer than the others, i’m trying to figure out how to control how many groups (or items) get displayed in each column, i.e, if i have 100 items in 12 groups, i’d like to have 4 groups in each of the 3 columns. Would your web part help me do this, or can you provide me any advice on how i could do this myself?
    Thanks

  99. Waldek Mastykarz Says:

    @Dean: Unfortunately paging wouldn't help you in your scenario. You would need to create some kind of counter that would allow you to track how many items have been already rendered in the specific group.

  100. Content Query Web Part Paging « bastiaanjacobs.nl Says:

    [...] http://blog.mastykarz.nl/sharepoint-2010-content-query-web-part-paging/ [...]

  101. Blogempfehlung http://blog.mastykarz.nl - SharePointBlog Says:

    [...] 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 [...]

  102. Tinker Says:

    deployed – inserted and referring to the 2 xsl files – but no paging appears… what am I doing wrong?

  103. Waldek Mastykarz Says:

    @Tinker: Have you configured the paging parameter and page size in CQWP's properties?

  104. Tinker Says:

    I got it working … needed to choose the pagecontrols

Leave a Reply

Security Code:

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS
Copyright © 2007 - 2012 Waldek Mastykarz

Creative Commons License