kentico 10 subscrting

hassan kalach asked on September 26, 2017 13:47

si i am using substring macros for a content on my repeare but some of the content are rich texts and some time the substring cut a tag in half and then the whole section is broken what the solution for that ?

Correct Answer

Trevor Fayas answered on September 26, 2017 14:18

You have to use the strip tags method Kentico provided first so you only substring non html. It's possible to try to make a custom macro that splits then tried to close open tags but usually not worth it.

If you need the html put the entire string and use a jQuery plugin to hide most of it.

0 votesVote for this answer Unmark Correct answer

Recent Answers


hassan kalach answered on September 26, 2017 14:23

okay great thank you

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on September 27, 2017 16:06 (last edited on September 27, 2017 16:07)

Actaully there already macro methods that you can use:

  1. StripTags - Removes all HTML tags from the specified text.
  2. LimitLength - Limits the length of the string to the specified number of characters (where set the wholeWords parameter to true, the method preserves the last word in the string)
0 votesVote for this answer Mark as a Correct answer

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