How to make Editable regions (Text area type) to reflect Enter press as a new line

This article describes how to make Editable regions of Text area type to reflect Enter press as a new line and display it correctly wrapped on the live site.
You could ensure it by replacing "\n" with "<br />".

For example you could duplicate the standard Editable text web part and change its code behind like this:

(line about 598 - just after: ControlsHelper.ResolveDynamicControls(this);)

if (this.RegionType == CMSEditableRegionTypeEnum.TextArea)
this.ltlContent.Text = Regex.Replace(this.ltlContent.Text, "\n", "<br />");

See also:

Applies to: Kentico CMS 4.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.