Skip to main content

Save and Restore Layout

ASPxHtmlEditor allows you to save its layout to a database, and then restore it. This information includes all settings that control the visibility and size of visual elements, their appearance settings, etc.

The HTML Editor’s ClientLayout event allows you to save the editor’s layout on any change and restore the layout on the first page load. Use the ASPxClientLayoutArgs.LayoutMode argument’s property to get whether to save or restore the editor’s layout.

The following example demonstrates how to save/restore the ASPxHtmlEditor layout to/from a data store:

protected void ASPxHtmlEditor1_ClientLayout(object sender, 
  DevExpress.Web.ASPxClientLayoutArgs e) {
    if (e.LayoutMode == DevExpress.Web.ClientLayoutMode.Saving) {
        SaveUserLayoutToDatabase(userID, "AccountTreeList", e.LayoutData);
    }
    else {
        if (System.IO.File.Exists(fileName))
            e.LayoutData = RestoreUserLayoutFromDatabase(userID, "AccountTreeList");
    }
}