Back to Devexpress

ASPxTreeList.SaveClientLayout() Method

aspnet-devexpress-dot-web-dot-aspxtreelist-dot-aspxtreelist-84545c4d.md

latest3.2 KB
Original Source

ASPxTreeList.SaveClientLayout() Method

Saves the ASPxTreeList layout.

Namespace : DevExpress.Web.ASPxTreeList

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

NuGet Package : DevExpress.Web

Declaration

csharp
public virtual byte[] SaveClientLayout()
vb
Public Overridable Function SaveClientLayout As Byte()

Returns

TypeDescription
Byte[]

An array of bytes that contains the ASPxTreeList’s layout data.

|

Remarks

Use the SaveClientLayout property to save the ASPxTreeList layout. To control what information on the layout can be saved, use options provided by the ASPxTreeList.SettingsCookies property.

To load a previously saved layout, use the ASPxTreeList.LoadClientLayout method.

Example

This example shows how to manually save and restore the previously saved layout. When the Save Layout or Load Layout button is clicked, the tree list’s client ASPxClientTreeList.PerformCallback method is used to send a callback to the server. This generates the server-side ASPxTreeList.CustomCallback event, which is handled to save or restore the tree list’s layout.

csharp
protected void ASPxTreeList1_CustomCallback(object sender,
DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e) {
    if (e.Parameters == "save") {
        SaveUserLayoutToDatabase("userID", "TreeListLayout", ASPxTreeList1.SaveClientLayout());
    }
    if (e.Parameters == "load") {
        ASPxTreeList1.LoadClientLayout(GetUserLayoutFromDatabase("userID", "TreeListLayout"));
    }
}
vb
Protected Sub ASPxTreeList1_CustomCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs)
    If e.Parameters = "save" Then
        SaveUserLayoutToDatabase("userID", "TreeListLayout", ASPxTreeList1.SaveClientLayout())
    End If

    If e.Parameters = "load" Then
        ASPxTreeList1.LoadClientLayout(GetUserLayoutFromDatabase("userID", "TreeListLayout"))
    End If
End Sub

See Also

LoadClientLayout(Byte[])

SettingsCookies

Tree List

ASPxTreeList Class

ASPxTreeList Members

DevExpress.Web.ASPxTreeList Namespace