Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: Firefox Issue!
Re: Firefox Issue!
11-26-2004, 4:46 PM
KenA
Joined on 01-11-2004
Posts 66
Re: Firefox Issue!
Reply
Quote
Sure ... below is the code:
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %> <%@ Page language="c#" Codebehind="Contact.aspx.cs" AutoEventWireup="false" Inherits="Mista.Contact" %> <!doctype html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt" lang="pt"> <head> <title>..: Contact :..</title> </head> <body> <form id="Form1" method="post" runat="server"> <asp:label id="lblMsg" runat="server"></asp:label> <br> <ce:editor TemplateItemList="[Save,Bold,Italic,Help]/[MyHolderName]" id="ce1" width="270" height="200" runat="server"></ce:editor> </form> </body> </html>
using System.Configuration; using Mista.Code; using CuteEditor; using System.Web.Mail; using System.Text.RegularExpressions; public class Contact : System.Web.UI.Page { protected CuteEditor.Editor ce1; protected System.Web.UI.WebControls.Label lblMsg; protected TextBox tbxEmail; private string PageName { get { return Request.Url.ToString(); } } private void Page_Load(object sender, System.EventArgs e) { ConfigCE(); } private void ConfigCE() { Label lblSendTo = new Label(); lblSendTo.Text=" email: "; ce1.ToolControls["MyHolderName"].Control.Controls.Add(lblSendTo); //create a new instance and set it to the class field tbxEmail = new TextBox(); tbxEmail.ID = "tbxEmail"; tbxEmail.Style["vertical-align"] = "middle"; tbxEmail.Width = 200; tbxEmail.Style["font-family"] = "verdana"; tbxEmail.Style["font-size"] = "0.7em"; tbxEmail.Style["color"] = "gray"; //listen it's event (if you want) tbxEmail.TextChanged += new EventHandler(tbxEmail_TextChanged); //add tbxEmail to the MyHolderName specified by the editor1.TemplateItemList ce1.ToolControls["MyHolderName"].Control.Controls.Add(tbxEmail); //ce1.AutoConfigure = AutoConfigure.Minimal; ce1.BreakElement = BreakElement.Br; ce1.HelpUrl = "mailto:geral@mista.com.br?subject=Help From Contact Form"; ce1.RemoveServerNamesFromUrl = false; ce1.FrameStyle.Width = Unit.Percentage(98); //see:http://cutesoft.net/forums/ShowPost.aspx?PostID=2619 } private void tbxEmail_TextChanged(object sender, EventArgs e) { //Assert sender==tbxEmail //TextBox tbx = new TextBox(); //tbx = (TextBox)sender; //if( sender==tbxEmail ) } private void ce1_TextChanged(object sender, System.EventArgs e) { } private void ce1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e) { if( string.Compare(e.CommandName,"Save",true)==0 ) { if( tbxEmail.Text.Trim().Length==0 ) { //lblMsg.ForeColor = Color.DarkRed; lblMsg.Style["Font-Family"] = "Palatino Linotype"; lblMsg.Style["Color"] = "Red"; lblMsg.Style["Font-Size"] = "0.8em"; lblMsg.Text = "E-mail address!"; } else if( !IsValidEmailFormat(tbxEmail.Text.Trim()) ) { lblMsg.Style["Font-Family"] = "Palatino Linotype"; lblMsg.Style["Color"] = "Red"; lblMsg.Style["Font-Size"] = "0.8em"; lblMsg.Text = "Invalid e-mail format!"; } else if( Utils.StripHtmlTags( this.ce1.Text.Trim() ) == "" ) { lblMsg.Style["Font-Family"] = "Palatino Linotype"; lblMsg.Style["Color"] = "Red"; lblMsg.Style["Font-Size"] = "0.8em"; lblMsg.Text = "Type your message!"; } else { lblMsg.Style["Font-Family"] = "Palatino Linotype"; lblMsg.Style["Color"] = "Green"; lblMsg.Style["Font-Size"] = "0.8em"; GetMailSettings(); SendMail(); ShowOkMsg(); } return; } } public bool IsValidEmailFormat(string s) { Regex objPattern = new Regex( @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ); return objPattern.IsMatch(s); } MailMessage myMail; private void GetMailSettings() { myMail = new MailMessage(); myMail.From = tbxEmail.Text.Trim(); myMail.To = @ConfigurationSettings.AppSettings["MailTo"]; myMail.Subject = @ConfigurationSettings.AppSettings["MailSubject"]; myMail.BodyFormat = MailFormat.Html; myMail.Body = ce1.Text.Trim(); } private void SendMail() { try { SmtpMail.SmtpServer = @ConfigurationSettings.AppSettings["SmtpServerPath"]; SmtpMail.Send(myMail); } catch( Exception exc ) { string msg = "Error!<br />Page:" + PageName + "<br />Method:SendMail()<br />" + exc.ToString(); Page.Session.Add("Exc", msg); Page.Response.Redirect("~/CustomErrorMsgs.aspx"); } finally { myMail = null; } } private void ShowOkMsg() { lblMsg.Text = "Message sent with success!"; //string msg = "Mensagem Recebida ¤ Message Received"; //this.RegisterStartupScript( "id", "<script language='JavaScript'>alert('" + msg + "');</script>" ); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); } private void InitializeComponent() { this.ce1.PostBackCommand += new System.Web.UI.WebControls.CommandEventHandler(this.ce1_PostBackCommand); this.ce1.TextChanged += new System.EventHandler(this.ce1_TextChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion }
ps. I´ll download FireFox again and see what happens!
Regards,
»»» KenA
View Complete Thread