This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
/
Default.aspx.vb
44 lines (42 loc) · 1.54 KB
/
Default.aspx.vb
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
35
36
37
38
39
40
41
42
43
44
Imports System
Imports System.Web.UI
Imports DevExpress.XtraPivotGrid
Namespace ASPxPivotGrid_GroupFilter
Partial Public Class _Default
Inherits Page
Protected Sub ASPxRadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim group As PivotGridGroup = ASPxPivotGrid1.Groups(0)
group.FilterValues.Reset()
Select Case ASPxRadioButtonList1.SelectedIndex
Case 0
group.FilterValues.FilterType = PivotFilterType.Excluded
fieldShippedYear.ExpandAll()
fieldShippedMonth.ExpandAll()
Case 1
group.FilterValues.FilterType = PivotFilterType.Included
group.FilterValues.Values.Add(2014).ChildValues.Add(12)
group.FilterValues.Values.Add(2015).ChildValues.Add(1)
fieldShippedYear.ExpandAll()
fieldShippedMonth.CollapseAll()
Case 2
group.FilterValues.FilterType = PivotFilterType.Excluded
group.FilterValues.Values.Add(2014)
fieldShippedYear.CollapseAll()
fieldShippedMonth.CollapseAll()
Case 3
group.FilterValues.FilterType = PivotFilterType.Included
SelectFirstDays(group)
fieldShippedYear.ExpandAll()
fieldShippedMonth.ExpandAll()
End Select
End Sub
Private Sub SelectFirstDays(ByVal group As PivotGridGroup)
For Each year As Object In group.GetUniqueValues(Nothing)
Dim value As PivotGroupFilterValue = group.FilterValues.Values.Add(year)
For Each month As Object In group.GetUniqueValues(New Object() { year })
value.ChildValues.Add(month).ChildValues.Add(1)
Next month
Next year
End Sub
End Class
End Namespace