2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Retrieve the summary valuesYou can retrieve the information of the summary row by using the SelectionChanged event of GridGroupingControl. In the given sample, when the selected row element is summary, then you can get the information of the summary row using the GridEngine.GetSummaryText method. C# //For summary row selection this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Row | GridSelectionFlags.AlphaBlend; void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e) { // Checking whether RangeType is Rows if(e.Range.RangeType == GridRangeInfoType.Rows) { for(int row = e.Range.Top; row <= e.Range.Bottom; row++) { //Retrieving each element and converting as Element object Element element = gridGroupingControl1.Table.NestedDisplayElements[row]; if(element.Kind == DisplayElementKind.Summary) { //Converting Element object as GridSummaryRow object GridSummaryRow sr = element as GridSummaryRow; if(sr != null) { foreach(GridSummaryColumnDescriptor scd in sr.SummaryRowDescriptor.SummaryColumns) { string result = GridEngine.GetSummaryText(sr.ParentGroup, scd); //print the results in the output window //Console.WriteLine("GroupLevel = {0}, SummaryColumns_Name = {1}, Value = {2}", sr.GroupLevel, scd.Name, result); MessageBox.Show("GroupLevel = " + sr.GroupLevel + ", SummaryColumns_Name = " + scd.Name + " , Value = " + result); } } } } } } VB 'For summary row selection Me.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended Me.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Row Or GridSelectionFlags.AlphaBlend Private Sub TableModel_SelectionChanged(ByVal sender As Object, ByVal e As GridSelectionChangedEventArgs) ' Checking whether RangeType is Rows If e.Range.RangeType = GridRangeInfoType.Rows Then For row As Integer = e.Range.Top To e.Range.Bottom 'Retrieving each element and converting as Element object Dim element As Element = gridGroupingControl1.Table.NestedDisplayElements(row) If element.Kind = DisplayElementKind.Summary Then 'Converting Element object as GridSummaryRow object Dim sr As GridSummaryRow = TryCast(element, GridSummaryRow) If sr IsNot Nothing Then For Each scd As GridSummaryColumnDescriptor In sr.SummaryRowDescriptor.SummaryColumns Dim result As String = GridEngine.GetSummaryText(sr.ParentGroup, scd) 'print the results in the output window 'Console.WriteLine("GroupLevel = {0}, SummaryColumns_Name = {1}, Value = {2}", sr.GroupLevel, scd.Name, result); MessageBox.Show(result) Next scd End If End If Next row End If End Sub After applying the properties, the Grid is displayed as follows. Figure 1: The information of the summary row is displayed Samples: C#: Summary_values VB: Summary_values |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.