Re: Custom Button pasteing Javascript

  •  11-08-2008, 2:20 AM

    Re: Custom Button pasteing Javascript

    Hi jbucknor,
     
     
    Try this code please:
     

    <%@ Page Language="C#" %>

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            WebControl ctrl = Editor1.CreateCommandButton("MyButton", "text.gif", "Insert My Custom Text");
            string myString = "<script>document.write(\"Hello World!\")<" + "/script>";
           
            ctrl.Attributes["onclick"] = "CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,'"+myString+"')";
            Editor1.RegisterCustomButton("mybutton", ctrl);
        }

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CE:Editor ID="Editor1" runat="server" TemplateItemList="[Bold,Italic]/[mybutton]" EnableStripScriptTags="False">
                   
                </CE:Editor>
       
            </div>
        </form>
    </body>
    </html>

     
    Regards,
     
    Ken
View Complete Thread