GridSettingsBase.ClientLayout Property
Enables you to save and restore the previously saved layout of the extension.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
ASPxClientLayoutHandler | A ASPxClientLayoutHandler delegate method allowing you to implement custom processing. |
Remarks
Provide implementation of the delegated method to save and restore the grid’s layout from a data store.
@Html.DevExpress().GridView(settings => {
// ...
settings.ClientLayout = (s, e) => {
switch (e.LayoutMode) {
case ClientLayoutMode.Loading:
//Load Last ClientLayout Via First Load
if (Session["Layout"] != null) {
e.LayoutData = Session["Layout"].ToString();
}
break;
case ClientLayoutMode.Saving:
//Save Last ClientLayout Automatically
Session["Layout"] = e.LayoutData;
break;
}
};
}).Bind(Model).GetHtml()
Save Layout
The delegated method argument’s LayoutMode property returns Saving
. The LayoutData property contains the grid’s current layout that should be saved, for instance, to a database.
Restore Layout
The LayoutMode property returns Loading
. Read the grid’s layout data from a data store and assign it to the LayoutData property.
Note that there is a peculiarity when using the ClientLayout
in custom binding mode. See the GridView Custom Binding Limitations and CardView Custom Binding Limitations topics for more details.