Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
555
WebHtmlEditor - Add text dynamically
posted

Hi, I am currently using a WebHtmlEditor inside an ASPX. I want to be able to post some HTML text dynamically into the Editor from another Hidden field on my page to allow for HTML editing.

I was trying to dynamically load data into the editor via Javascript using the following approach...

<ighedit:WebHtmlEditor ImageDirectory="/GlobalResources/Images/htmleditor/" Width="100%"
            ID="RTEditor" runat="server" ViewStateMode="Enabled" EnableViewState="true">
   <Toolbar>....</Toolbar>
</ighedit:WebHtmlEditor>

$('#RTEditor').html(myhtmltexthere);    <== Does not work

Can someone please help?

  • 7570
    posted

    Hello a105019,

    Please let me know if you have any questions.

     

  • 7570
    posted

    Hello a105019,

    Thank you for contacting Infragistics!

    It is possible to add an object to the WebHTMLEditor using the following code:

    function insertObject(){
        // Get a reference to the editor.
        var _editor = iged_getById("WebHtmlEditor1");
        // Create a new span object.
        var object = document.createElement("SPAN");

        // Style the object and add text.
        object.style.background = "blue";
        object.style.color = "white";
        object.innerHTML = "An object is inserted.";   
       
        // Insert the object into WebHtmlEditor.
        _editor.insertAtCaret( object );
        // WebHtmlEditor can also insert text.
        _editor.insertAtCaret( "<br/>Text is inserted." );
    }

    For more information, please refer to the following documentation:

    http://help.infragistics.com/NetAdvantage/ASPNET/Current/CLR4.0/?page=WebHtmlEditor_Insert_Objects_into_WebHtmlEditor.html

    I hope this helps.

    If you have any quesitons, please let me know as well.