Rad Editor Inserting nonbreaking space

3 posts, 0 answers
  1. Rajasekhar
    Rajasekhar avatar
    15 posts
    Member since:
    Sep 2011

    Posted 09 Jan 2014 Link to this post

    Hi 

    We are using Telerik control Telerik.Web.UI.dll version "2013.2.717.40" . When we have some existing value on editor and then if we remove the value completely and we do not enter any new value in the rad editor, still editor returns "<P>&nsbp</P>" as value . We are expecting value as empty if nothing is entered in RadEditor

    Please suggest
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jan 2014 Link to this post

    Hi Rajasekhar,

    Please have a look into the following sample code snippet to achieve your scenario.

    ASPX:
    <telerik:RadEditor ID="RadEditor1" runat='server'>
    </telerik:RadEditor>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Get Data" AutoPostBack="false"
        OnClientClicked="Click">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function Click(sender, args) {
            var editor = $find("<%=RadEditor1.ClientID %>");
            if (editor.get_text() == "") {
                editor.set_html("");
                alert(editor.get_html());
            }
        }
    </script>

    Thanks,
    Shinu.
  3. Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 13 Jan 2014 Link to this post

    Hi Rajasekhar,

    Note that if the editor is set with the NewLineMode="P" property it is expected such element to be left in the content if it is not deleted. Please review this screencast, in which is shown this behavior.

    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top