How to insert content in editor

Last post 10-20-2004, 2:20 AM by azaldivar. 2 replies.
Sort Posts: Previous Next
  •  10-19-2004, 7:00 AM 2128

    How to insert content in editor

    Hi again,

     
    I've my editor with a custom button defined this way:
     

    Dim Image1 As New System.Web.UI.WebControls.Image

    Image1.ID = "Test" 'This ID will be used in template

    Image1.ToolTip = "Test Button"

    Image1.ImageUrl = HttpContext.Current.Request.ApplicationPath + "/btnCopiar.gif"

    Image1.CssClass = "button"

    Image1.Attributes.Add("onclick", "insertHTML('Editor1','Testing...')")

    Image1.Attributes.Add("type", "btn")

    Editor1.RegisterCustomButton(Image1)
     
    And the editor shows the button, nice. But when I press the custom button, the text "Testing..." is inserted into the background of the page, out of the Editor.
     
    I've (cassually) found the insertHTML function, but there isn't documentation about it or about any client-side function, so I don't know if I'am using it correctly.
     
    So, how can I insert content by an custom button into the editor?
     
    Thanks in advance.
  •  10-19-2004, 10:37 AM 2133 in reply to 2128

    Re: How to insert content in editor

    azaldivar,

     
    Try Change to the following line:
    Image1.Attributes.Add("onclick", "insertHTML('Editor1','Testing...')")
     
    to:
     
    Image1.Attributes.Add("onclick", "insertHTML('Editor1_editBox','Testing...')")
     
    Or you can use the JavaScript function in the addcustombuttons.aspx.
     

    <script language="JavaScript" type="text/javascript" >

        function Paste_Html1(editorID,value) {

                EditorID = editorID+"_editBox";

             var editor = document.getElementById(EditorID);

                editor.focus();

             var sel = editor.document.selection.createRange();

             if (editor.document.selection.type == 'Control') {

                 return;

               }

              sel.pasteHTML(value);

        }

    </script>


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-20-2004, 2:20 AM 2151 in reply to 2133

    Re: How to insert content in editor

    Ok, thank you very much.
View as RSS news feed in XML