Skip to main content
A newer version of this page is available. .

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 editor’s ASPxHtmlEditor.ClientLayout event enables you to save the editor’s layout each time it is changed and restore it on the first page load. This event provides the ASPxClientLayoutArgs.LayoutMode property, which indicates whether the editor’s layout should be saved or restored.

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");
    }
}