Display issue with editor for Enter Key

3 posts, 0 answers
  1. nickJr
    nickJr avatar
    18 posts
    Member since:
    Jul 2007

    Posted 29 May 2009 Link to this post

    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. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 01 Jun 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. PALANISAMY V
    PALANISAMY V avatar
    4 posts
    Member since:
    Aug 2009

    Posted 14 Aug 2009 Link to this post

    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
Back to Top