protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { PivotGridField fieldProductName = ASPxPivotGrid1.Fields["fieldProductName"]; PivotGridField fieldCountry = ASPxPivotGrid1.Fields["fieldCountry"]; ASPxPivotGrid1.BeginUpdate(); try { fieldProductName.FilterValues.Clear(); fieldProductName.FilterValues.Add("Chai"); fieldProductName.FilterValues.Add("Chang"); fieldProductName.FilterValues.Add("Chartreuse verte"); fieldProductName.FilterValues.Add("Ipoh Coffee"); fieldProductName.FilterValues.Add("Aniseed Syrup"); fieldProductName.FilterValues.Add("Genen Shouyu"); fieldProductName.FilterValues.Add("Gula Malacca"); fieldProductName.FilterValues.Add("Vegie-spread"); fieldCountry.FilterValues.Add("UK"); fieldProductName.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; fieldCountry.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; } finally { ASPxPivotGrid1.EndUpdate(); } } }
protected void ASPxComboBox1_SelectedIndexChanged(object sender, EventArgs e) { ASPxPivotGrid1.BeginUpdate(); switch (SelectedDemo) { case 0: ASPxPivotGrid1.Fields[0].Visible = true; ASPxPivotGrid1.Fields[0].Caption = "Product Group"; ASPxPivotGrid1.Fields[0].GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.Custom; ASPxPivotGrid1.Fields[0].AreaIndex = 0; ASPxPivotGrid1.Fields[4].Caption = "Year"; ASPxPivotGrid1.Fields[4].FilterValues.Clear(); ASPxPivotGrid1.Fields[4].GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.DateYear; ASPxPivotGrid1.Fields[3].Visible = false; ASPxPivotGrid1.Fields[3].GroupInterval = PivotGroupInterval.Default; break; case 1: ASPxPivotGrid1.Fields[3].Visible = true; ASPxPivotGrid1.Fields[3].Caption = "Year - Quarter"; ASPxPivotGrid1.Fields[3].GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.Custom; ASPxPivotGrid1.Fields[3].AreaIndex = 0; ASPxPivotGrid1.Fields[4].Caption = "Shipped Date"; ASPxPivotGrid1.Fields[4].FilterValues.Clear(); ASPxPivotGrid1.Fields[4].GroupInterval = DevExpress.XtraPivotGrid.PivotGroupInterval.Default; ASPxPivotGrid1.Fields[4].AreaIndex = 1; ASPxPivotGrid1.Fields[0].Visible = false; ASPxPivotGrid1.Fields[0].GroupInterval = PivotGroupInterval.Default; break; } ASPxPivotGrid1.EndUpdate(); ASPxPivotGrid1.CollapseAll(); }
void InitPivotGrid() { string strReportType = "reportproduct"; if (reportType["ReportType"].Equals("ReportMaterial")) { strReportType = "reportmaterial"; } else if (reportType["ReportType"].Equals("ReportDevice")) { strReportType = "reportdevice"; } else if (reportType["ReportType"].Equals("ReportFinish")) { strReportType = "reportfinishedproduct"; } // Change this property to transpose the chart. ASPxPivotGrid1.OptionsChartDataSource.ProvideDataByColumns = false; ASPxPivotGrid1.BeginUpdate(); ASPxPivotGrid1.DataSource = GetData(strReportType); SetFilter(); ASPxPivotGrid1.EndUpdate(); SetSelection(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { PivotGridField field = ASPxPivotGrid1.Fields["Country"]; // Locks the control to prevent excessive updates when multiple properties are modified. ASPxPivotGrid1.BeginUpdate(); try { // Clears the filter value collection and add two items to it. field.FilterValues.Clear(); field.FilterValues.Add("Brazil"); field.FilterValues.Add("USA"); // Specifies that the control should only display the records // which contain the specified values in the Country field. field.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; } finally { // Unlocks the control. ASPxPivotGrid1.EndUpdate(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { PivotGridField field = ASPxPivotGrid1.Fields["Year"]; ASPxPivotGrid1.BeginUpdate(); try { field.FilterValues.Clear(); field.FilterValues.Add(1996); field.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included; } finally { ASPxPivotGrid1.EndUpdate(); } } // Sets fields' sort mode to Custom to raise the CustomServerModeSort event. fieldOrderMonth.SortMode = PivotSortMode.Custom; fieldCategoryName.SortMode = PivotSortMode.Custom; }