Carriage returns in Html

7 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 20 Oct 2009 Link to this post

    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
  2. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 20 Oct 2009 Link to this post

    It gets alot better when saving to the DB with RadEditor.Text, but one space is always written at the end of the line.

    ??
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 22 Oct 2009 Link to this post

    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?
  5. Sups
    Sups avatar
    24 posts
    Member since:
    Jul 2007

    Posted 22 Oct 2009 Link to this post

    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 
  6. Rumen
    Admin
    Rumen avatar
    12848 posts

    Posted 23 Oct 2009 Link to this post

    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.
  7. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 23 Oct 2009 Link to this post

    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


  8. Rumen
    Admin
    Rumen avatar
    12848 posts

    Posted 28 Oct 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017