Html Editor Help.

Page 1 of 2 12 LastLast
  1. #1

    Html Editor Help.

    Hi,
    I have been using Coolite tools for couple of months but i never used the html editor. I want to use it for a message form.
    I put the editor inside a Panel like in the Examples. After click an ajaxbutton to send the messsage form, not getting the "content" in the html editor. How can i get the content?
    please help.

    Here where the editor is
     <ext:Panel ID="Panel1" runat="server" Width="700" Height="300" Html="Içerik" BodyStyle="padding:6px;"
                                        Title="Editor panel" Border="true" AutoScroll="true">
                                        <TopBar>
                                            <ext:Toolbar ID="Toolbar1" runat="server">
                                                <Items>
                                                    <ext:ToolbarButton ID="Button1" runat="server" Text="Düzenle" Icon="Pencil">
                                                        <Listeners>
                                                            <Click Handler="el.setDisabled(true);#{Button2}.setDisabled(false);#{PanelEditor}.startEdit(#{Panel1}.getBody());" />
                                                        </Listeners>
                                                    </ext:ToolbarButton>
                                                    <ext:ToolbarButton ID="Button2" runat="server" Text="Kaydet" Icon="Disk" Disabled="true">
                                                        <Listeners>
                                                            <Click Handler="el.setDisabled(true);#{Button1}.setDisabled(false);#{PanelEditor}.completeEdit();" />
                                                        </Listeners>
                                                    </ext:ToolbarButton>
                                                </Items>
                                            </ext:Toolbar>
                                        </TopBar>
                                    </ext:Panel>
                                    <br />
                                    <ext:Editor ID="PanelEditor" runat="server" AutoSize="Fit" Shadow="None">
                                        <Field>
                                            <ext:HtmlEditor ID="HtmlEditor1" runat="server" />
                                        </Field>
                                    </ext:Editor>
    here where it get called
     protected void SendInfo(object sender, AjaxEventArgs e)
        {
            
            string content = HtmlEditor1.Value.ToString();//return " " 
           
            
        }
  2. #2

    RE: Html Editor Help.

    I have the same problem. Can't get html editor text. I used .text property but nothing happens. Can anyone help? By the way, I used de example from examples.ext.net.
    Last edited by geoffrey.mcgill; Feb 22, 2011 at 3:28 AM.
  3. #3

    RE: Html Editor Help.

    You can get by Panel1.Html. Note: Panel.Html only get content. You can't set any value by C#.
  4. #4

    RE: Html Editor Help.

    Thanks a lot for your response! I have tree comments:

    1.- I finally could retrieve content from html editor, by using a toolbar button, using an example I found in a post, like this:
                                                        <ext:ToolbarButton ID="Button2" runat="server" Text="Enviar" Icon="Disk" Disabled="true">
                                                            <Listeners>
                                                                <Click Handler="el.setDisabled(true);#{Button1}.setDisabled(false);#{PanelEditor}.completeEdit();" />
                                                            </Listeners>
                                                            <AjaxEvents>
                                                            <Click OnEvent="Button_Click" Type="Load" Method="POST">
                                                                <EventMask ShowMask="true" Msg="Saving..." MinDelay="500" />
                                                                <ExtraParams>
                                                                <ext:Parameter Name="Message1" Value="#{HtmlEditor1}.getValue()" Mode="Raw" />
                                                                </ExtraParams>
                                                            </Click>
                                                            </AjaxEvents>
                                                        </ext:ToolbarButton>
    works finte, but when I send an e-mail whith this content using C#, inbox email allways shows html code, tags are changed to "&amp;lt;" and "&amp;gt;" By means of C# code I force to change for tags, now html code is well formated but e-mail still shows as html code. For instance, recieved e-mail's body looks like this: <P>This is content.&amp;amp;nbsp;
    <STRONG>Bold</STRONG> <EM>Italic</EM>
    <U>Underline</U></P>

    Is any way to make it show without this tags?(but with format, of course)

    2.- In some posts, someone recomends htmlEditor1.Text to get content. Does't work. nothing is returned. Why?

    3.- Panel1.Html doesn't work either, only gets te original text. When I run the code, If I change something in editor, still get the original text (html property in panel1).

    Thanks in advance,

    Jaime.
  5. #5

    RE: Html Editor Help.

    I am having the same problem which Jamie has..Please can anybody help on this asap..

    Thanks
    reema
  6. #6

    RE: Html Editor Help.

    reemashah (4/19/2010) I am having the same problem which Jamie has..Please can anybody help on this asap..

    Thanks
    reema
    Someone is going to have to post a complete .aspx code sample demonstrating how to reproduce the scenario.

    Geoffrey McGill
    Founder
  7. #7

    RE: Html Editor Help.

    The following sample appears to work as expected.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            this.Label1.Html = this.HtmlEditor1.Text;
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Button runat="server" Text="Submit" OnDirectClick="Button1_Click" />
            
            <ext:HtmlEditor ID="HtmlEditor1" runat="server" />
            
            <ext:Label ID="Label1" runat="server" />
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder
  8. #8

    RE: Html Editor Help.

    Hi geoffrey,

    I tried using the same but when i tried to look at the value of HtmlEditor in firbug it does not contain any value.This is the problem that i am having if i use anything in user control but cannot get any text values in code behind file.I dont know why but if i trace my code in firebug then i cannot find any text field values into code behind file.

    If you want i can paste my code and you can check that.

    Thanks,
    Reema
  9. #9

    RE: Html Editor Help.

    my .ascx file

    
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Email.ascx.cs" Inherits="Email" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <asp:ObjectDataSource ID="NoteDataSource" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetNoteData" TypeName="dsHorizonTableAdapters.NoteTableAdapter"
        UpdateMethod="Update" OnInserting="NoteDataSource_Inserting" OnUpdating="NoteDataSource_Updating">
        <UpdateParameters>
            <asp:Parameter Name="TableId" DbType="Guid" />
            <asp:Parameter DbType="Guid" Name="RowId" />
            <asp:Parameter DbType="Guid" Name="NoteTypeId" />
            <asp:Parameter Name="Display" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="UpdateDate" Type="DateTime" />
            <asp:Parameter Name="UpdateUser" Type="String" />
            <asp:Parameter Name="NoteTypeDisplay" Type="String" />
            <asp:Parameter DbType="Guid" Name="Original_Id" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter DbType="Guid" Name="Id" />
            <asp:Parameter Name="TableId" DbType="Guid" />
            <asp:Parameter DbType="Guid" Name="RowId" />
            <asp:Parameter DbType="Guid" Name="NoteTypeId" />
            <asp:Parameter Name="Display" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="UpdateDate" Type="DateTime" />
            <asp:Parameter Name="UpdateUser" Type="String" />
            <asp:Parameter Name="NoteTypeDisplay" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <ext:Store ID="NoteStore" runat="server" DataSourceID="NoteDataSource" OnBeforeRecordInserted="NoteStore_BeforeRecordInserted"
        OnBeforeRecordUpdated="NoteStore_BeforeRecordUpdated">
        <Reader>
            <ext:JsonReader ReaderID="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="RowId" />
                    <ext:RecordField Name="TableId" />
                    <ext:RecordField Name="NoteTypeId" />
                    <ext:RecordField Name="Display" />
                    <ext:RecordField Name="Description" />
                    <ext:RecordField Name="IsActive" />
                    <ext:RecordField Name="NoteTypeDisplay" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Listeners>
            <LoadException Handler="Ext.Msg.alert('Note Data - Load failed', e.message || e )" />
            <CommitFailed Handler="Ext.Msg.alert('Note Data - Commit failed', 'Reason: ' + msg)" />
            <SaveException Handler="Ext.Msg.alert('Note Data - Save failed', e.message || e)" />
        </Listeners>
    </ext:Store>
    <ext:Window ID="EmailEditorWindow" runat="server" Icon="EmailEdit" Modal="True" Show&#111;nload="false"
        AnimCollapse="true" Width="600" Height="470" Title="Email">
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:ToolbarButton ID="Send" runat="server" Text="Send" Icon="EmailGo">
                        <AjaxEvents>
                            <Click OnEvent="SendEmail" Method="POST">
                                <EventMask Msg="Sending.." ShowMask="true" />
                                <ExtraParams>
                                    <ext:Parameter Name="BCC" Value="#{BCC}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="Body" Value="#{Body}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="Subject" Value="#{Subject}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="From" Value="#{From}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="To" Value="#{To}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="Template" Value="#{Template}.getValue()" Mode="Raw" />
                                    <ext:Parameter Name="CC" Value="#{CC}.getValue()" Mode="Raw" />
                                    <%--<ext:Parameter Name="AccountId" Value="#{HiddendAccount_id}.getValue()" Mode="Raw" />--%>
                                </ExtraParams>
                            </Click>
                        </AjaxEvents>
                    </ext:ToolbarButton>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <Body>
            <ext:FitLayout ID="Fitlayout1" runat="server">
                <ext:FormPanel ID="EmailPanel" runat="server" Frame="true" ButtonAlign="Center" LabelWidth="40">
                    <Body>
                        <ext:Panel runat="server">
                            <Body>
                                <ext:ColumnLayout runat="server">
                                    <ext:LayoutColumn ColumnWidth=".5">
                                        <ext:Panel runat="server" Border="false" Header="false">
                                            <Body>
                                                <ext:FormLayout runat="server" LabelAlign="Left" LabelWidth="60">
                                                    <Anchors>
                                                        <ext:Anchor Horizontal="96%">
                                                            <ext:TextField ID="To" runat="server" FieldLabel="To" TabIndex="1" />
                                                        </ext:Anchor>
                                                        <ext:Anchor Horizontal="96%">
                                                            <ext:TextField ID="Subject" runat="server" FieldLabel="Subject" TabIndex="2" />
                                                        </ext:Anchor>
                                                        <ext:Anchor Horizontal="96%">
                                                            <ext:ComboBox ID="Template" runat="server" FieldLabel="Template" TabIndex="3">
                                                            </ext:ComboBox>
                                                        </ext:Anchor>
                                                    </Anchors>
                                                </ext:FormLayout>
                                            </Body>
                                        </ext:Panel>
                                    </ext:LayoutColumn>
                                    <ext:LayoutColumn ColumnWidth=".5">
                                        <ext:Panel runat="server">
                                            <Body>
                                                <ext:FormLayout runat="server" LabelAlign="Left" LabelWidth="40">
                                                    <Anchors>
                                                        <ext:Anchor Horizontal="98%">
                                                            <ext:TextField ID="CC" runat="server" FieldLabel="CC" TabIndex="4" />
                                                        </ext:Anchor>
                                                        <ext:Anchor Horizontal="98%">
                                                            <ext:TextField ID="BCC" runat="server" FieldLabel="BCC" TabIndex="5" />
                                                        </ext:Anchor>
                                                        <ext:Anchor Horizontal="98%">
                                                            <ext:TextField ID="From" runat="server" FieldLabel="From" TabIndex="6" />
                                                        </ext:Anchor>
                                                    </Anchors>
                                                </ext:FormLayout>
                                            </Body>
                                        </ext:Panel>
                                    </ext:LayoutColumn>
                                </ext:ColumnLayout>
                            </Body>
                        </ext:Panel>
                        <ext:Panel runat="server">
                            <Body>
                                <ext:FormLayout runat="server" LabelAlign="Top">
                                    <Anchors>
                                        <ext:Anchor Horizontal="100%">
                                            <ext:HtmlEditor ID="Body" runat="server" Height="300" FieldLabel="Body" TabIndex="7" EscapeValue="false" />
                                        </ext:Anchor>
                                        <ext:Anchor Horizontal="100%">
                                            <ext:Label ID="label1" runat="server" Height="300" FieldLabel="label" />
                                        </ext:Anchor>
                                    </Anchors>
                                </ext:FormLayout>
                            </Body>
                        </ext:Panel>
                    </Body>
                </ext:FormPanel>
            </ext:FitLayout>
        </Body>
    </ext:Window>
    my .ascx.cs file

    
    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using Coolite.Ext.Web;
    using System.Net.Mail;
    //using System.Web.Mail;
    
    
    public partial class Email : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
    
        protected void NoteStore_BeforeRecordInserted(object sender, BeforeRecordInsertedEventArgs e)
        {
    
        }
    
        protected void NoteStore_BeforeRecordUpdated(object sender, BeforeRecordUpdatedEventArgs e)
        {
            e.NewValues["UpdateUser"] = Session["UserName"];
            e.NewValues["UpdateDate"] = DateTime.Now;
        }
    
        protected void NoteStore_AfterRecordUpdated(object sender, AfterRecordUpdatedEventArgs e)
        {
            String RoleId = e.NewValues["RoleId"].ToString();
        }
    
        protected void NoteDataSource_Updating(object source, ObjectDataSourceMethodEventArgs e)
        {
            e.InputParameters.Remove("NoteTypeDisplay");
        }
    
        protected void NoteDataSource_Inserting(object source, ObjectDataSourceMethodEventArgs e)
        {
            e.InputParameters.Remove("NoteTypeDisplay");
        }
    
        protected void SendEmail(object sender, AjaxEventArgs e)
        {
            this.label1.Text = this.Body.Text;
            String to = e.ExtraParams["To"].ToString();
            String from = e.ExtraParams["From"].ToString();
            String bcc = e.ExtraParams["BCC"].ToString();
            String cc = e.ExtraParams["CC"].ToString();
            String subject = e.ExtraParams["Subject"].ToString();
            String template = e.ExtraParams["Template"].ToString();
            String body = e.ExtraParams["Body"].ToString().Trim();
            //String account_id = e.ExtraParams["AccountId"].ToString();
            String Result = SendMailMessage(from, to, bcc, cc, subject, body);
            if (Result == "true")
            {
                NoteDataSource.InsertParameters["Id"].DefaultValue = Guid.NewGuid().ToString();
                NoteDataSource.InsertParameters["TableId"].DefaultValue = "11111111-8082-4509-a2a5-1922c86d9877";
                NoteDataSource.InsertParameters["RowId"].DefaultValue = null;
                NoteDataSource.InsertParameters["NoteTypeId"].DefaultValue = "afc27487-8082-4509-a2a5-1922c86d9877";
                NoteDataSource.InsertParameters["Display"].DefaultValue = subject;
                NoteDataSource.InsertParameters["Description"].DefaultValue = body;
                NoteDataSource.InsertParameters["UpdateUser"].DefaultValue = Session["UserName"].ToString();
                NoteDataSource.InsertParameters["UpdateDate"].DefaultValue = DateTime.Now.ToString();
                int i=NoteDataSource.Insert();
                NoteStore.DataBind();
                Ext.MessageBox.Alert("Success", "Email Sent Successfully!!!").Show();
            }
    
        }
    
        public static String SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
        {
            // Instantiate a new instance of MailMessage
            MailMessage mMailMessage = new MailMessage();
    
            // Set the sender address of the mail message
            mMailMessage.From = new MailAddress(from);
            // Set the recepient address of the mail message
            mMailMessage.To.Add(new MailAddress(to));
    
            // Check if the bcc value is null or an empty string
            if ((bcc != null) &amp;&amp; (bcc != string.Empty))
            {
                // Set the Bcc address of the mail message
                mMailMessage.Bcc.Add(new MailAddress(bcc));
            }
    
            // Check if the cc value is null or an empty value
            if ((cc != null) &amp;&amp; (cc != string.Empty))
            {
                // Set the CC address of the mail message
                mMailMessage.CC.Add(new MailAddress(cc));
            }
    
            // Set the subject of the mail message
            mMailMessage.Subject = subject;
            // Set the body of the mail message
            mMailMessage.Body = body;
    
            // Secify the format of the body as HTML
            mMailMessage.IsBodyHtml = true;
    
            // Set the priority of the mail message to normal
            mMailMessage.Priority = MailPriority.Normal;
    
            // Instantiate a new instance of SmtpClient
            SmtpClient mSmtpClient = new SmtpClient();
            // Send the mail message
            mSmtpClient.Send(mMailMessage);
            
            return "true";
        }
    }
  10. #10

    RE: Html Editor Help.

    Is all that code required to reproduce the problem? I pasted your sample in a test project and it threw an Exception.

    Geoffrey McGill
    Founder
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] HTML editor with IE 8
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 17, 2010, 7:59 AM
  2. html editor
    By [WP]joju in forum 1.x Help
    Replies: 3
    Last Post: Dec 21, 2009, 9:23 AM
  3. 0.82 html editor bug
    By [WP]joju in forum Bugs
    Replies: 3
    Last Post: Dec 21, 2009, 1:48 AM
  4. html editor in IE8
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Dec 02, 2009, 10:24 AM
  5. [CLOSED] html editor
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 24, 2009, 11:06 AM

Posting Permissions