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.

1 Answer 1


In your webpart constructor just set the property there.

public MyCustomWebpart()
     this.Xsl = "<xml></xml>";

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.