ASPxGridBase.ClientLayout Event
Enables you to save and restore the previously saved layout of the grid.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
Event Data
The ClientLayout event's data class is ASPxClientLayoutArgs. 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. |
Remarks
Handle the ClientLayout event to save and restore the grid’s layout from a data store.
Save Layout
The event parameter’s ASPxClientLayoutArgs.LayoutMode property returns ClientLayoutMode.Saving. The ASPxClientLayoutArgs.LayoutData property contains the grid’s current layout that should be saved, for instance, to a database.
To control what information on the layout can be saved, use the options provided by the SettingsCookies property.
Restore Layout
- The ASPxClientLayoutArgs.LayoutMode property returns ClientLayoutMode.Loading. Read the grid’s layout data from a data store and assign it to the ASPxClientLayoutArgs.LayoutData property.
You can also save and restore the grid’s layout via the ASPxGridBase.SaveClientLayout and ASPxGridBase.LoadClientLayout methods.
Concept
Example
This example shows how to save or restore the ASPxGridView layout to or from a data store.
protected void ASPxGridView1_ClientLayout(object sender,
DevExpress.Web.ASPxClientLayoutArgs e) {
if (e.LayoutMode == DevExpress.Web.ClientLayoutMode.Saving) {
SaveUserLayoutToDatabase(userID, "AccountGrid", e.LayoutData);
}
else {
if (System.IO.File.Exists(fileName))
e.LayoutData = RestoreUserLayoutFromDatabase(userID, "AccountGrid");
}
}