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

Carriage returns in Html

6 Answers 164 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 20 Oct 2009, 01:53 PM
Hi,
I have a hard time to compare database fields which are filled through RadEditor.

Carriage returns are written to the database when saving RadEditor.Html, because of this I cannot compare two text fields.

Any suggestion how to skip these Carriage Returns? I tried Replace VbCrLf without succes.

Thanks,
Marc

6 Answers, 1 is accepted

Sort by
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 20 Oct 2009, 02:04 PM
It gets alot better when saving to the DB with RadEditor.Text, but one space is always written at the end of the line.

??
0
Ivan Queiroz
Top achievements
Rank 1
answered on 22 Oct 2009, 03:16 PM
I also have a similar problem. Additionally, if the user delete all text, the carriage return and <div> are preserved. How can this be prevented?
0
Sups
Top achievements
Rank 1
answered on 23 Oct 2009, 12:32 AM
I also have the same problem.
The problem comes when you try to get data using radeditor.text. There is always a space(&nbsp;) before the each new line. No idea whats to be done. Tried to replace vbLr with "" and vbCr & " " with "" but didnt work.

Any solution for this space issue?

Thanks 
0
Rumen
Telerik team
answered on 23 Oct 2009, 06:19 AM
Hi guys,

Please, try the solution provided in the following KB article on the subject: "\r\n" being added to content when submitted, e.g.

You can use the String.Replace method to strip vbCrLf w:

RadEditor1.Content = RadEditor1.Content.Replace(vbCrLf, "")
or
RadEditor1.Text = RadEditor1.Text.Replace(vbCrLf, "")

Sincerely,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ivan Queiroz
Top achievements
Rank 1
answered on 23 Oct 2009, 11:45 AM
This is how I solved (I hope) my issue:

Dim radContent  As String = RadEditor1.Content

radContent.Replace("<br />", "")
radContent.Replace("<div>", "")
radContent.Replace("</div>", "")
radContent.Replace("&nbsp;", "")
radContent.Trim(Chr(110), "")
radContent.Trim(Chr(10), "")
radContent.Trim()

After doing the above and if nothing remains in the content (radContent.length = 0), I know that the user has tried to delete the editor's content.

It would be great if this could be done client-side.

** Leftover stuff when an user tries to delete everything from the editor:
   Chrome - "<br />"
    Firefox and IE - <br />, <div>, &nbsp; ASCII 10, ASCII 110


0
Rumen
Telerik team
answered on 28 Oct 2009, 12:32 PM
Hello Ivan,

You can strip these symbols on the client by writing a custom content filter similar to this one provided in this KB article: Converting Unicode symbols to numeric HTML entities using a content filter.

Greetings,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Ivan Queiroz
Top achievements
Rank 1
Sups
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or