protected void btnLoad_Click(object sender, EventArgs e) { MemoryStream collapseStateStream = (MemoryStream)(Session["CollapseStateStream"]); string layout = (string)(Session["Layout"]); if (layout == null || collapseStateStream == null) { return; } ASPxPivotGrid1.LoadLayoutFromString(layout, PivotGridWebOptionsLayout.DefaultLayout); collapseStateStream.Seek(0, SeekOrigin.Begin); ASPxPivotGrid1.LoadCollapsedStateFromStream(collapseStateStream); }