CuteEditor and Autosave

Last post 11-27-2012, 6:37 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  11-27-2012, 2:26 AM 75351

    CuteEditor and Autosave

    Hi all,

     

    I'd like to implement autosave to my CuteEditor so that the current text is saved every minute. I've found this old thread from 2007 (CuteEditor and Autosave) but as this is now 5 years ago I wonder whether there is any update and / or a codeexample is available?

    Many thanks!


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
    Filed under:
  •  11-27-2012, 6:37 AM 75352 in reply to 75351

    Re: CuteEditor and Autosave

    Hi Kai2,

     

    Please try the example below, it will save the editor content every 5 seconds. Change 5000 to 60000 is 1 minute.

    1. <%@ Page Language="C#" %> 
    2.  
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %> 
    4. <html> 
    5. <head> 
    6.     <title>example </title> 
    7. </head> 
    8.  
    9. <script runat="server"
    10.  
    11.     protected void btn_save_Click(object sender, EventArgs e) 
    12.     { 
    13.         //get editor content and save into the textbox 
    14.         tbContent.Text = Editor1.Text; 
    15.     } 
    16. </script> 
    17.  
    18. <body> 
    19.     <form id="Form1" runat="server"
    20.         <CE:Editor ID="Editor1" runat="server" EnableStripScriptTags="false"
    21.         </CE:Editor> 
    22.         <asp:Button ID="btn_save" runat="server" Style="visibility: hidden" OnClick="btn_save_Click" /><br /> 
    23.         <asp:TextBox ID="tbContent" runat="server" TextMode="multiLine" Rows="10" Width="600px"></asp:TextBox> 
    24.     </form> 
    25. </body> 
    26. </html> 
    27.  
    28. <script> 
    29. //save content every 5 seconds. 
    30. //60000 is 1 minute 
    31. setTimeout(saveContent,5000); 
    32. function saveContent() 
    33.     var btn_save=document.getElementById("<%= btn_save.ClientID %>"); 
    34.     btn_save.click(); 
    35. </script> 

    Regards,

     

    Ken

View as RSS news feed in XML