I've developed an extended Webpart that inherits from CSWP because we have arround 30 templates each one with many style variations... so that style variations were exposed with webpart probs and the Template parses the values through javascript and it all runs smoothly.

The problem:

The client want's the possibility to run a template on server side through the old method XSLT and i developed a custom xlst and it's rendering alright but all the webpart properties that were parsed in client-side now can't... somehow I need to pass Server properties to my XSLT and i don't know how.

I know that the CQWP add a method to inject Server properties and methods from a class to xslt but i've exhausted every ideas and didn't came out with a solution.

Anyone knows a solution for this ?

  • I have exact the same problem. Did you find a solution for that so far? Thanks for your help. Apr 2, 2014 at 9:52

1 Answer 1


I found an answer for that and documented it here:


You have to inherit from the CSWP and override the OnPreRender method.

There in the ControlsCollection you will find the ServerRenderer Control. This Control is used when server-rendering is used :)

As this control inherits from the DataFormWebPart you can than use the normal way via ParameterValues.Set("name","value") to set the values that then can be used in the XSL File.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.