Back to Devexpress

ASPxGridBase.LoadClientLayout(String) Method

aspnet-devexpress-dot-web-dot-aspxgridbase-dot-loadclientlayout-x28-system-dot-string-x29.md

latest3.0 KB
Original Source

ASPxGridBase.LoadClientLayout(String) Method

Restores a grid layout from the specified string.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public virtual void LoadClientLayout(
    string layoutData
)
vb
Public Overridable Sub LoadClientLayout(
    layoutData As String
)

Parameters

NameTypeDescription
layoutDataString

A String value that contains the grid’s layout data.

|

Remarks

Use the LoadClientLayout property to restore the grid layout. To save a grid layout, use the SaveClientLayout() method. You can specify what information on the layout can be saved by using options provided by the SettingsCookies property.

Example: How to Change the Grid Layout in Exported Document

To apply a custom layout to an exported document, call the LoadClientLayout method in the BeforeExport event handler. In this case, the layout settings affect the exported document content only and do not affect the current grid UI.

aspx
<dx:ASPxGridView ID="grid" runat="server" DataSourceID="CustomerReportsDataSource" 
    OnBeforeExport="grid_BeforeExport"/>
csharp
protected void Page_Init(object sender, EventArgs e) {
    // Save the default grid layout.
    Session["layout"] = grid.SaveClientLayout();
}
protected void grid_BeforeExport(object sender, DevExpress.Web.ASPxGridBeforeExportEventArgs e) {
    // Load the default layout.
    grid.LoadClientLayout(Session["layout"].ToString());
}
vb
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
    ' Save the default grid layout.
    Session("layout") = grid.SaveClientLayout()
End Sub

Protected Sub grid_BeforeExport(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridBeforeExportEventArgs)
    ' Load the default layout.
    grid.LoadClientLayout(Session("layout").ToString())
End Sub

See Also

SaveClientLayout()

ASPxCardView.SettingsCookies

ASPxGridView.SettingsCookies

ASPxVerticalGrid.SettingsCookies

ASPxGridBase Class

ASPxGridBase Members

DevExpress.Web Namespace