SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a custom Search results web part by inheriting from coreresultswebpart. I would like to override the default XSL with some modified XSL in my project instead of having to set the XSL using the web part properties on the site.

I have already added a few custom properties to my custom webpart and found a msdn article discussing the DataFormWebPart.Xsl Property. Just not sure how to take my modified XSL and set it to that property.

share|improve this question
up vote 2 down vote accepted

In your webpart constructor just set the property there.

public MyCustomWebpart()
     this.Xsl = "<xml></xml>";
share|improve this answer
Thanks Steve, this worked great. – Jason Jones Apr 27 '12 at 17:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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