It is known that OOB Content Query Web Part (CQWP) renders results using Lists for arranging items as shown below
In ASP.NET WebForms for Web Control DataList there is a possibility to specify layout rendering mode using property RepeatLayout, what if the similar functionality would be available in CQWP?
So, our goal to extend CQWP, i.e. in addition to List Layout rendering mode, lets implement functionality for rendering Content Query Web Part results in Plain Old Table Layout.
In this approach, we would like to achieve the following options:
- Possibility to easily arrange results in columns
- Specify items direction (horizontal or vertical)
Solution Structure
Content Query Web Part Class
Tool Part Class Implementation with the ability to specify Table Layout properties
Web Part manifest file
Pay attention that we provide custom XSLT for processing of the CQWP, for more details see How to: Customize XSL for the SharePoint Content By Query Web Part.
Main XSLT style sheet for rendering results in Table Layout
Results
Below is shown Web Part configured to display results in 4 columns and horizontal mode layout