Re: CuteEditor and Autosave

  •  11-27-2012, 6:37 AM

    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 Complete Thread