Support forums

Losing Editor content when saving

Last post 09-02-2008, 1:25 PM by ValleyHope. 3 replies.
Sort Posts: Previous Next
  •  08-12-2008, 3:45 PM 42918

    Losing Editor content when saving

    I have some weird behavior happening.  CuteEditor v6.1.0.0.  I have a page where a user will take a while to type in it, and for security purposes I can't/won't change the session expiration on my website. (By the way, this is not meant to start a security debate).
    I enabled a javascript timer set to go off at 10 minutes, fires up a click event on a button, and the button's click event will save the Editor.Text in the database, reloads the page, therefore renewing the session and so on.  I'm testing in all 4 "major" browsers, IE7, FF3, Safari 3.1.2(win) and Opera 9.51.
    Scenario 1:
    I type whatever on the editor and close to the 10 minute mark (actually for testing I have it set for 1 minute) before I get the popup message, I stop typing, let it sit for a few seconds, let the message popup, click on OK, let the page refresh.  When I check the database, whatever I typed, it's there.
    Here is the kicker -  If I continue typing for the duration of the timer (60 seconds for testing) and I'm still typing when the message pops up, click on the OK, reloads the page...  with IE7, the content is there, with the rest of the browsers I get a blank message.
    Scenario 2:
    Same setup, but with a plain 'ol <asp:textbox> as the "editor".  Both times, by stoping before the timer runs thru, or continuing to type, the data is there on all 4 browsers.
    So it leads me to believe it's a behavior with CuteEditor.  Any ideas?
  •  08-13-2008, 11:26 AM 42938 in reply to 42918

    Re: Losing Editor content when saving

    Can you post the code showing how you trigger this event, how you get the data from editor? Chat
    Web Messenger: wysiwyg editor:
    asp wysiwyg html editor: Image Gallery:
    Live Support:

  •  08-15-2008, 8:53 AM 42997 in reply to 42938

    Re: Losing Editor content when saving

    Here is the ascx:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="PM_Add.ascx.cs" Inherits="xxx.yyy" %>

    <asp:UpdatePanel ID="up_PMAdd" runat="server" UpdateMode="Conditional">
      <table width="100%">
        <td colspan="3">
         <asp:DropDownList ID="ddl_SentTo" runat="server" />
        <td colspan="3">
         <asp:TextBox ID="TextBox1" runat="server" Width="300px" TabIndex="1" />
        <td colspan="3">
         <VHA:Editor ID="Editor_NewPM_Counselor" runat="server" AllowPasteHtml="false" Width="100%"
          Height="250px" ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/VHAMinimal.config"
          ConvertHTMLTagstoLowercase="true" EditorOnPaste="Default" ShowBottomBar="false" />
    <asp:Literal ID="lbl_AutoSave" runat="server" />
    <asp:Timer ID="Timer_PMAdd" runat="server" Interval="15000" OnTick="Timer_PMAdd_Tick" />
    <span style="visibility: hidden;">
        <asp:Button ID="Button1" runat="server" /></span>
    <VHAAjax:ModalPopupExtender ID="mpu_AutoSave" BehaviorID="mdlPopup" runat="server"
        TargetControlID="Button1" PopupControlID="pnl_AutoSave" BackgroundCssClass="modalBackground" />
    <asp:Panel ID="pnl_AutoSave" runat="server" CssClass="confirm-dialog" Style="display: none;">
        <div class="inner">
                You are reaching the end of your session.</h5>
            <p style="padding-right: 20px; text-align: justify;">
                In order for you to keep the data you have entered so far, it will be saved for
                you. The page will reload and you can continue typing your message.</p>
            <asp:Button ID="btn_AutoSave" runat="server" Text="Save" OnClick="btn_AutoSave_Click" />

    And here is the codebehind

    using System;
    using System.Data;
    using System.Data.Sql;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Profile;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using VHA.OCC.BLL;

    namespace xxx
        public partial class yyy : System.Web.UI.UserControl
            string cs_Live = ConfigurationManager.ConnectionStrings["XXX"].ConnectionString;
            string AutoSave = "";

            protected void Page_Load(object sender, EventArgs e)
                if (!Page.IsPostBack)
                    if (Request.QueryString["AutoSave"] != null)
                        AutoSave = Request.QueryString["AutoSave"].ToString();
                    if (AutoSave == "")
                        //Do all initial display of controls
                        //Grab the data and put it in the controls ie.  Editor_PM_Add.Text = reader["xxx"];

            protected void Timer_PMAdd_Tick(object sender, EventArgs args)
                Timer_PMAdd.Enabled = false;

            protected void btn_AutoSave_Click(object sender, EventArgs e)
                string SID = Session.SessionID.ToString() + Session["NewLoginID"];
                string tempSubject = "";
                string tempMessage = "";
                string tempSendTo = "";

       tempSendTo = ddl_SentTo.SelectedValue.ToString();
       tempSubject = TextBox1.Text.Replace("'", "''");
       tempMessage = Editor_NewPM_Counselor.Text.Replace("'", "''");

       string aSql = "SELECT SessionID FROM XXX WHERE SessionID LIKE '" + SID + "'";

                SqlConnection aConn = new SqlConnection(cs_Live);
                SqlCommand aComm = new SqlCommand(aSql, aConn);
                SqlDataReader a;
                a = aComm.ExecuteReader();

                if (a.Read())
                    string bSql = "UPDATE XXX SET MessageContent = '" + tempMessage + "', MessageSubject = '" + tempSubject + "' WHERE SessionID LIKE '" + SID + "'";
                    SqlConnection bConn = new SqlConnection(cs_Live);
                    SqlCommand bComm = new SqlCommand(bSql, bConn);

                    Response.Redirect("PM_Add.aspx?AutoSave=" + DateTime.Now.ToUniversalTime() + "", true);
                    string cSql = "INSERT INTO XXX (SessionID, MessageType, MessageContent, MessageSubject) VALUES ('" + SID + "', 'PM', '" + tempMessage + "', '" + tempSubject + "')";
                    SqlConnection cConn = new SqlConnection(cs_Live);
                    SqlCommand cComm = new SqlCommand(cSql, cConn);

                Response.Redirect("PM_Add.aspx?AutoSave=" + DateTime.Now.ToUniversalTime() + "", true);

    By the way, I'm running the latest version 6.1.2
  •  09-02-2008, 1:25 PM 43440 in reply to 42997

    Re: Losing Editor content when saving

    Any ideas?
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems