Intersoft Support Center

Activate Auto Save

WebTextEditor introduces innovative feature which performs auto saving based on configurable interval.  Auto save operation will be invoked through AJAX callback and will be performed only when the document is modified. Developers can write their own codes to handle the auto saving operation in Save server-side event. For instances, the content can be saved to a file, database, or other storage.

This topic will show you how to perform auto save feature.

To activate auto save

  1. Set EnableAutoSave property to true.
  2. Set AutoSaveInterval property, default is 15 minutes.
  3. Handle OnSave server-side event.
  4. Implement save mechanism in OnSave server-side event.

    C# Copy ImageCopy Code
    protected void WebTextEditor1_Save(object sender, WebTextEditorSaveArgs e)
    {      
       if (e.SaveAction == SaveAction.AutoSave)      
       {             
          StreamWriter sw = new StreamWriter(HttpContext.Current.Server.MapPath("./SampleHtml/AutoSave.html"));
          sw.Write(e.Content);             
          sw.Flush();             
          sw.Close();      
       }
    }

The above sample will perform auto save every 15 minute and the content will be saved to file “AutoSave.html”.

Previous Next