Andy,
You can find the source code of the examples in the CuteEditor download package.
Here is the source code of the adding custom button:
<%@ Page Language="C#"%>
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
<html>
<head>
<title>ASP and ASP.NET WYSIWYG Editor - Add custom buttons </title>
<link rel="stylesheet" href="../example.css" type="text/css" />
</head>
<body >
<form runat="server" ID="Form1">
<h1>Add custom buttons</h1>
<hr />
<P>This example shows you how easy it can be to <b>add your own functions</b> to the CuteEditor with the help of CuteEditor extended functionalities. </P>
<br />
<CE:Editor id="Editor1" EditorWysiwygModeCss="../example.css" Height="200" runat="server" TemplateItemList="Bold,Italic,Underline,JustifyLeft,JustifyCenter,JustifyRight,InsertUnorderedList,Separator,Indent, Outdent, insertcustombutonhere"></CE:Editor><BR>
<asp:textbox id="TextBox1" Runat="server">OKOK</asp:textbox>
</form>
</body>
</html>
<script language="JavaScript" type="text/javascript" >
function CatchCommand(editor)
{
if(event.command=='MyCmd')
{
editor.ExecCommand("InsertTable");
event.returnValue=false;
}
}
</script>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
if(! this.IsPostBack )
{
Editor1.Attributes["oncommand"]="return CatchCommand(this);";
}
CuteEditor.ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];
if(tc!=null)
{
System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();
Image1.ToolTip = "Insert today's date";
Image1.ImageUrl = "tools.gif";
Image1.CssClass = "CuteEditorButton";
SetMouseEvents(Image1);
Image1.Attributes["onclick"]="var d = new Date(); CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,d.toLocaleDateString())";
tc.Control.Controls.Add(Image1);
Button postbutton=new Button();
postbutton.Click+=new EventHandler(postbutton_Click);
postbutton.Text="PostBack";
postbutton.Style["vertical-align"]="middle";
tc.Control.Controls.Add(postbutton);
System.Web.UI.WebControls.Image Image2 = new System.Web.UI.WebControls.Image();
Image2.ToolTip = "Using oncommand";
Image2.ImageUrl = "tools.gif";
Image2.CssClass = "CuteEditorButton";
SetMouseEvents(Image2);
Image2.Attributes["Command"]="MyCmd";
tc.Control.Controls.Add(Image2);
//Editor1.AddToolControl("CustomPostBack",postbutton);
}
}
void SetMouseEvents(WebControl control)
{
control.Attributes["onmouseover"]="CuteEditor_ButtonCommandOver(this)";
control.Attributes["onmouseout"]="CuteEditor_ButtonCommandOut(this)";
control.Attributes["onmousedown"]="CuteEditor_ButtonCommandDown(this)";
control.Attributes["onmouseup"]="CuteEditor_ButtonCommandUp(this)";
control.Attributes["ondragstart"]="CuteEditor_CancelEvent()";
}
private void postbutton_Click(object sender, EventArgs e)
{
TextBox1.Text="PostButton Clicked";
}
</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