Enables you to save and restore the previously saved layout of the ASPxTreeList.
Namespace: DevExpress.Web.ASPxTreeList
Assembly: DevExpress.Web.ASPxTreeList.v19.2.dll
public event ASPxClientLayoutHandler ClientLayout
Public Event ClientLayout As ASPxClientLayoutHandler
The ClientLayout event handler receives an argument of the ASPxClientLayoutArgs type. The following properties provide information specific to this event.
Property | Description |
---|---|
LayoutData | Gets or sets the layout data. |
LayoutMode | Indicates whether a control's layout should be saved or restored. |
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.
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");
}
}
Protected Sub ASPxTreeList1_ClientLayout(sender As Object, _
e As DevExpress.Web.ASPxClientLayoutArgs)
If e.LayoutMode = DevExpress.Web.ClientLayoutMode.Saving Then
SaveUserLayoutToDatabase(userID, "AccountTreeList", e.LayoutData)
Else
If File.Exists(fileName) Then
e.LayoutData = RestoreUserLayoutFromDatabase(userID, "AccountTreeList")
End If
End If
End Sub