Skip to main content

How to: Save and Restore the ASPxCardView's Layout

Example 1

The following example shows how to save or restore the ASPxCardView layout to or from a data store.

protected void CardView_ClientLayout(object sender, ASPxClientLayoutArgs e)
    if (e.LayoutMode == DevExpress.Web.ClientLayoutMode.Saving) {
        SaveUserLayoutToDatabase(userID, "Account", e.LayoutData);
    else {
        if (System.IO.File.Exists(fileName))
            e.LayoutData = RestoreUserLayoutFromDatabase(userID, "Account");

Example 2

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

protected void ASPxCardView1_CustomCallback(object sender, ASPxCardViewCustomCallbackEventArgs e)
if (e.Parameters == "save") {
    SaveUserLayoutToDatabase("userID", "Layout", ASPxCardView1.SaveClientLayout());
if (e.Parameters == "load") {
    ASPxCardView1.LoadClientLayout(GetUserLayoutFromDatabase("userID", "Layout"));


To specify which information on the ASPxCardView layout can be saved, use options provided by the ASPxCardView.SettingsCookies property.