Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: HowTo: Get ceToolbar Custom Object Values
Re: HowTo: Get ceToolbar Custom Object Values
11-26-2004, 11:19 AM
cutechat
Joined on 07-22-2004
Posts 2,332
Re: HowTo: Get ceToolbar Custom Object Values
Reply
Quote
KenA :
I just write a sample for you :
aspx:
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %> <%@ Page language="c#" Codebehind="TextBox1.aspx.cs" AutoEventWireup="false" Inherits="CuteEditorWeb.HowTo.RegisterCustomButton.TextBox1" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>TextBox1</title> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="FlowLayout"> <form id="Form1" method="post" runat="server"> <asp:Label id="Label1" runat="server">Command Message Here</asp:Label><BR> <CE:EDITOR id="Editor1" runat="server" TemplateItemList="[Save,Bold,Italic,JustifyLeft,JustifyRight,JustifyCenter]/[MyHolderName]"></CE:EDITOR> </form> </body> </HTML>
aspx.cs:
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace CuteEditorWeb.HowTo.RegisterCustomButton { public class TextBox1 : System.Web.UI.Page { protected CuteEditor.Editor Editor1; #region Web Auto Gen override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); } private void InitializeComponent() { this.Editor1.PostBackCommand += new System.Web.UI.WebControls.CommandEventHandler(this.Editor1_PostBackCommand); this.Editor1.TextChanged += new System.EventHandler(this.Editor1_TextChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion protected System.Web.UI.WebControls.Label Label1; protected TextBox tbxMail; private void Page_Load(object sender, System.EventArgs e) { Label lblSendTo=new Label(); lblSendTo.Text=" TO : "; Editor1.ToolControls["MyHolderName"].Control.Controls.Add(lblSendTo); //create a new instance and set it to the class field tbxMail=new TextBox(); tbxMail.ID="tbxMail"; tbxMail.Style["vertical-align"]="middle"; //listen it's event (if you want) tbxMail.TextChanged+=new EventHandler(tbxMail_TextChanged); //add tbxMail to the MyHolderName specified by the editor1.TemplateItemList Editor1.ToolControls["MyHolderName"].Control.Controls.Add(tbxMail); } private void tbxMail_TextChanged(object sender, EventArgs e) { //Assert sender==tbxMail } private void Editor1_TextChanged(object sender, System.EventArgs e) { } private void Editor1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e) { if(string.Compare(e.CommandName,"Save",true)==0) { string mail=tbxMail.Text.Trim(); if(mail.Length==0) { Label1.ForeColor=Color.DarkRed; Label1.Text="Please input the e-mail address!"; } else { Label1.ForeColor=Color.Empty; Label1.Text="This mail has been sent to : "+mail; } return; } } } }
If you have any questions about this sample , please reply this thread .
Regards , Terry .
View Complete Thread