Skip to main content

RichEditSettings.AutoSaveMode Property

Specifies whether the autosave mode is enabled.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v23.2.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public AutoSaveMode AutoSaveMode { get; set; }

Property Value

Type Description
AutoSaveMode

One of the AutoSaveMode values.

Available values:

Name Description
Default

The autosave feature is disabled by default. If a document is opened by multiple controls with different values of the AutoSaveMode property, the autosave feature is enabled for every control. The timeout is set to the smallest value among all these controls.

On

The autosave mode is enabled. The control saves the active document automatically on each timeout.

Remarks

Set the AutoSaveMode property to On to make the Rich Text Editor save the active document automatically on each timeout specified by the AutoSaveTimeout property. Note, to improve editor performance, the DocumentManager processes multiple documents in parts with a 20-second interval. This behavior can cause a difference between the specified and the actual autosave timeout. For instance, when the specified timeout is short and the document manager processes a lot of documents, the actual timeout duration can increase.

If a document is opened by multiple Rich Text Editors with the autosave feature enabled, the timeout is set to the smallest value among all these editors.

@Html.DevExpress().RichEdit(settings => {
    settings.Name = "RichEdit";
    settings.CallbackRouteValues = new { Controller = "DocumentManagement", Action = "LoadAndSavePartial" };
    settings.WorkDirectory = "~/App_Data/Documents";
    settings.AutoSaveMode = DevExpress.Web.Office.Internal.AutoSaveMode.On;
    TimeSpan timeout = TimeSpan.FromMinutes(1);
    settings.AutoSaveTimeout = timeout;
}).GetHtml()

The autosave feature invokes the AutoSaving event that allows you to implement custom autosave logic. If you do not handle the event (the e.Handled property is set to false), the editor processes the document in the following ways:

  • If a document is opened from the server’s local file system, the editor overwrites the original document file.
  • If a document is new, or a document was opened from a custom document storage, the editor throws an exception. Handle the AutoSaving event to implement custom saving logic.
See Also