Showing posts with label strip paragraph. Show all posts
Showing posts with label strip paragraph. Show all posts

Wednesday, June 23, 2010

Strip paragraph tags in umbraco properties using C#

Today I was pulling some properties from an umbraco document for use in a user control, and I found to my horror that some of the content still had starting and ending paragraph tags around it. This was of course thanks to the rich text editor,TinyMCE.
Normally, while using xslt one would write the following to remove them quickly.

<umbraco:item field='property' stripParagraph='true'
runat='server'>
Not finding an equivalent function in the umbraco API, i wrote this quick-and-dirty method that works quite well for the task(at least for me). Hope it saves some time for you.