Back to Devexpress

ASPxTreeList.ClientLayout Event

aspnet-devexpress-dot-web-dot-aspxtreelist-dot-aspxtreelist-dc655936.md

latest2.9 KB
Original Source

ASPxTreeList.ClientLayout Event

Enables you to save and restore the previously saved layout of the ASPxTreeList.

Namespace : DevExpress.Web.ASPxTreeList

Assembly : DevExpress.Web.ASPxTreeList.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event ASPxClientLayoutHandler ClientLayout
vb
Public Event ClientLayout As ASPxClientLayoutHandler

Event Data

The ClientLayout event's data class is ASPxClientLayoutArgs. The following properties provide information specific to this event:

PropertyDescription
LayoutDataGets or sets the layout data.
LayoutModeIndicates 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

  • Restore Layout

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.

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

See Also

Tree List

ASPxTreeList Class

ASPxTreeList Members

DevExpress.Web.ASPxTreeList Namespace