Re: Custom Button pasteing Javascript

  •  11-04-2008, 11:31 PM

    Re: Custom Button pasteing Javascript

    Hi jbucknor,
     
     
    Try this example:
     

    <%@ 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");
            ctrl.Attributes["onclick"] = "CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,'<h2>Hello World</h2>')";
            Editor1.RegisterCustomButton("mybutton", ctrl);
        }

    </script>

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