This is a migrated thread and some comments may be shown as answers.

Display issue with editor for Enter Key

2 Answers 124 Views
Editor
This is a migrated thread and some comments may be shown as answers.
nickJr
Top achievements
Rank 1
nickJr asked on 29 May 2009, 03:20 PM
I am trying to save the content in a radEditor to the database. I dont want to save all the html tags. So when I save the data to the database, I use textView.Text instead of textView.Content (txtView is the radEditor name). I only want to preserve the return key. When I look at the database i see the text saved without any html and I see small sqaure boxes for the carriage return key as well. So its all good.
However, when I repopulate the editor with the text from the database, the carriage return is not applied. All the text is in one line without line breaks.
I tried adding NewLineBr="true", StripFormattingOptions="AllExceptNewLines" , StripFormattingOnPaste="AllExceptNewLines".

Non of them worked.
How can I achieve this?. I just want to preserve the carriage return when repopulating the rad editor. I see the small squres in the database which I think is for the carriage return.

Please advice.
thanks!

2 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 01 Jun 2009, 01:07 PM
Hi nickJr,

The Text property of RadEditor returns editor content as pure text. It does convert <BR/> tags into \n lines correctly - so, if you later load the editor content in a textarea, it will display those new lines correctly.

However, since you load content back into the editor, of course, there is a problem. "\n" symbols mean nothing in HTML - they are simply ignored by the browser. So, to display content in several lines, you should use code such as
editor1.Content = dbContent.Replace("\n", "<br/>");


Best wishes,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
PALANISAMY V
Top achievements
Rank 1
answered on 14 Aug 2009, 06:01 AM
Hi,
editor1.Content = dbContent.Replace("\n", "<br/>");
also not working..
1) when we binding data with rad edition, carriage return not working...

kindly do favour. because this is very urgent.
Thanks in advance,
V.Palanisamy
Tags
Editor
Asked by
nickJr
Top achievements
Rank 1
Answers by
Tervel
Telerik team
PALANISAMY V
Top achievements
Rank 1
Share this question
or