Question

Using C#, I am inserting web parts into web part zones programmatically and styling them. More specifically, I'm inserting CQWP's and assigning XSLT files to them.

I'm now wanting to allow users to insert their own CQWP's into the web part zone's through the UI and make available the same styles.

I can obviously insert the CQWP into the zone, but under Item Styles I don't see the same templates as what are defined in my XSLT file, which I can see for the CQWP's that were inserted programmatically.

Why are none of the XSLT templates available to me under the available styles for these CQWP's?

Was it helpful?

Solution

If you insert the default CQWP throught the UI it will automatically use the ItemStyle.xsl from the Style Library by default.

In order to do what you want to do, you'd have to create your own CQWP and add some EditorPart or Toolpart to it in which you include the functionality to be able to choose whatever XSLT file for itemstyles you want.

Here's an example on how to extend the CQWP (aka. create your own).

Here's an example on how to add your own EditorPart/ToolPart to the webpart.

Hope it helps :)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top