ASPxTreeList.ClientLayout Event
Enables you to save and restore the previously saved layout of the ASPxTreeList.
Namespace: DevExpress.Web.ASPxTreeList
Assembly: DevExpress.Web.ASPxTreeList.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
public event ASPxClientLayoutHandler ClientLayout
#Event Data
The ClientLayout event's data class is ASPxClientLayoutArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Layout |
Gets or sets the layout data. |
Layout |
Indicates whether a control’s layout should be saved or restored. |
#Remarks
Handle the ClientLayout event to save and restore the tree list’s layout from a data store.
Save Layout
The event parameter’s ASPxClientLayoutArgs.LayoutMode property returns ClientLayoutMode.Saving. The ASPxClientLayoutArgs.LayoutData property contains the tree list’s current layout that should be saved, for example, to a database.
To control what information on the layout can be saved, use the options provided by the ASPxTreeList.SettingsCookies property. For example, use the SettingsCookies‘ TreeListSettingsCookies.StoreColumnsVisiblePosition property to store visible columns position:
Restore Layout
The ASPxClientLayoutArgs.LayoutMode property returns ClientLayoutMode.Loading. Read the tree list’s layout data from a data store and assign it to the ASPxClientLayoutArgs.LayoutData property.
You can also save and restore the tree list’s layout by using the ASPxTreeList.SaveClientLayout and ASPxTreeList.LoadClientLayout methods.
#Example
This example shows how to save/restore the ASPxTreeList’s layout to/from a data store.
protected void ASPxTreeList1_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");
}
}