This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
34 lines (33 loc) · 1.47 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.IO;
using System.Web.UI;
using DevExpress.Utils;
using DevExpress.Web.ASPxPivotGrid;
namespace ASPxPivotGrid_SaveLoadCollapsedState {
public partial class _Default : Page {
protected void btnSave_Click(object sender, EventArgs e) {
Session["Layout"] = ASPxPivotGrid1.SaveLayoutToString( PivotGridWebOptionsLayout.DefaultLayout );
MemoryStream collapseStateStream = (MemoryStream)(Session["CollapseStateStream"]);
if (collapseStateStream != null) {
collapseStateStream.Dispose();
}
collapseStateStream = new MemoryStream();
ASPxPivotGrid1.SaveCollapsedStateToStream(collapseStateStream);
Session["CollapseStateStream"] = collapseStateStream;
}
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);
}
protected void btnClear_Click(object sender, EventArgs e) {
ASPxPivotGrid1.Fields.Clear();
}
}
}