aspnet-devexpress-dot-web-dot-aspxgridbase-4feaa919.md
Saves the grid layout.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public virtual string SaveClientLayout()
Public Overridable Function SaveClientLayout As String
| Type | Description |
|---|---|
| String |
A String value that contains the ASPxGridView’s layout data.
|
Call the SaveClientLayout method to save the grid layout. To control what information on the layout can be saved, use options provided by the SettingsCookies property.
Use the LoadClientLayout(String) method to load a previously saved layout.
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.
<dx:ASPxGridView ID="grid" runat="server" DataSourceID="CustomerReportsDataSource"
OnBeforeExport="grid_BeforeExport"/>
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());
}
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