Get Content from TreeNode without html tags

Alex Golebiewski asked on March 26, 2015 23:18

How can I get the content out of the DocumentContent field (or other field) on a TreeNode but have it strip the tags to put into a content field on a custom search?

Thank you, Alex

Recent Answers


Brenden Kehren answered on March 26, 2015 23:25

There is a transformation method you should be able to take advantage of called <%# StripTags("Sample text <br />") %>.

0 votesVote for this answer Mark as a Correct answer

Alex Golebiewski answered on March 26, 2015 23:28

I'm working with the C# API and if I use HTMLHelper.StripTags() I still get <![CDATA[

Testing Testing Testing

]]>.

I need to strip it all out to only have the Testing Testing Testing since there could be multiple webparts on the page, and I just need the content for the search.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 26, 2015 23:38

Ahh I see now. I know there is a transformation method that handles that but I don't believe it will work for you. You might use a regex in conjunction with the StripTags() method to clean things up.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.