Editor in aspx page not returning changed text in IE 8

Last post 09-20-2011, 3:32 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  09-20-2011, 2:13 PM 70120

    Editor in aspx page not returning changed text in IE 8

    I have an editor in a Visual Studio 2010 environment running the dev server and the editor works fine except when it's time to save its contents, the server-side code doesn't recognize changes in the editor.  I'm sure there is something very simple I'm missing, but I can't seem to find it.
     
    Thanks!
     

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <CE:Editor ID="Editor1" runat="server" AutoConfigure="Simple"

    ShowCodeViewToolBar="False" Width="100%" ThemeType="Office2007"

    Height="640px" />

    protected void btnSave_Click(object sender, EventArgs e)

    {

    //editor text is changing in client but not translating to server control

    string connStr = ConfigurationManager.ConnectionStrings["SDMADirCTF"].ConnectionString;

    SqlConnection connObj = new SqlConnection(connStr);

    connObj.Open();

    SqlCommand cmdObj = new SqlCommand("ctf.SaveAttyEmailMsg", connObj);

    cmdObj.CommandType = CommandType.StoredProcedure;

    cmdObj.Parameters.AddWithValue("@messageText", this.Editor1.Text);

    try

    {

    cmdObj.ExecuteNonQuery();

    }

    finally

    {

    connObj.Close();

    }

    Server.Transfer("/Admin.aspx");

    }


    Gary
    Filed under: ,
  •  09-20-2011, 3:32 PM 70122 in reply to 70120

    Re: Editor in aspx page not returning changed text in IE 8

    Hi LawProgrammer,
     
    In example below, the button does not get the new content and set for label1
     
    <%@ Page Language="C#" %>

    <%@ Register Namespace="CuteEditor" Assembly="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)
        {
            editor1.Text = "I am label1";
            label1.Text = editor1.Text;
            base.OnLoad(e);
        }


        protected void btn_change_Click(object sender, EventArgs e)
        {
            label1.Text = editor1.Text;
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CE:Editor ID="editor1" runat="server">
                </CE:Editor>
                <asp:Button ID="btn_change" runat="server" Text="Get editor text" OnClick="btn_change_Click" />
                <asp:Label ID="label1" runat="server"></asp:Label>
            </div>
        </form>
    </body>
    </html>
     
    And in the example below, the button get and set the new content correct.
     
     
    <%@ Page Language="C#" %>

    <%@ Register Namespace="CuteEditor" Assembly="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)
        {
            if (!IsPostBack)
            {
                editor1.Text = "I am label1";
                label1.Text = editor1.Text;
            }

            base.OnLoad(e);
        }


        protected void btn_change_Click(object sender, EventArgs e)
        {
            label1.Text = editor1.Text;
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CE:Editor ID="editor1" runat="server">
                </CE:Editor>
                <asp:Button ID="btn_change" runat="server" Text="Get editor text" OnClick="btn_change_Click" />
                <asp:Label ID="label1" runat="server"></asp:Label>
            </div>
        </form>
    </body>
    </html>
     
    Please use the same way on your site. If you still can not get it work, please create an example page which can reproduce this issue and post here, I will check it and get back to you as soon as possible.
     
    Regards,
     
    Ken
View as RSS news feed in XML