Hello all. I'm trying to figure out how to configure a summaryrow to evaluate only the selected rows when multiple rows are selected. The evaluation event handler would need to fire and update the summary total each time the selected rows collection changes. So far I have not been able to find any examples of this behavior. A point in the right direction will be appreciated.
I have tried working with the "CustomSummaryItem" from the forum but this only fires the evaluation event once and doesn't summarize changing selections- it only evaluates the first row in the grid. I have this small bit of code posted below and my alteration is in bold. I suspect I need to subscribe to some other (less documented) method.
Thanks in advance - Mike
I found this class in the forum ----------------------------------
Public Class CustomSummaryItem
Inherits GridViewSummaryItem
Public Sub New(ByVal name As String, ByVal formatString As String, ByVal aggregate As GridAggregateFunction)
MyBase.New(name, formatString, aggregate)
End Sub
Public Overrides Function Evaluate(ByVal row As IHierarchicalRow) As Object
Dim itemsummary As Decimal = 0
For Each childRow As GridViewRowInfo In row.ChildRows
If childRow.IsSelected Then
itemsummary += CDec(childRow.Cells("miles_driven").Value)
End If
Next childRow
Return itemsummary
End Function
End Class