我们网格中的一列,“EstimateDate”在未估算作业时为空。
因此,要计算网格中估计作业数量的摘要中的计数,有必要计算“EstimateDate”不为空的行数。
我相信我需要处理CustomSummaryCalculate,但如何检查该特定列是否为空?
Fwiw,这不是我需要做的唯一一个列,它也不是网格的KeyField。我已经检查了这个不适用的解决方案。 (http://www.devexpress.com/Support/Center/Question/Details/Q507778)
谢谢!
答案 0 :(得分:0)
以下是我最终解决问题的方法:
Dim leadcount,estimatecount,bookedcount,completedcount As Integer
受保护的子ASPxGridView1_CustomSummaryCalculate(ByVal sender As Object,ByVal e As DevExpress.Data.CustomSummaryEventArgs)处理ASPxGridView1.CustomSummaryCalculate
Try
'Summary items are defined by the tag set in the summary item in the summary section of the aspx page
Dim SummaryItem As String = (TryCast(e.Item, ASPxSummaryItem)).Tag
Select Case SummaryItem
Case "LeadDate"
Cust_Calc_Count_Not_Empty(sender, e, leadcount)
Case "EstimateDate"
Cust_Calc_Count_Not_Empty(sender, e, estimatecount)
Case "BookDate"
Cust_Calc_Count_Not_Empty(sender, e, bookedcount)
Case "CompletedDate"
Cust_Calc_Count_Not_Empty(sender, e, completedcount)
End Select
Catch ex As Exception
End Try
End Sub
Sub Cust_Calc_Count_Not_Empty(ByVal sender As Object, e As DevExpress.Data.CustomSummaryEventArgs, ByRef counter As Integer)
Try
Dim item As ASPxSummaryItem = TryCast(e.Item, ASPxSummaryItem)
' Initialize summary
If e.SummaryProcess = DevExpress.Data.CustomSummaryProcess.Start Then
counter = 0
End If
' Perform calculations
If e.SummaryProcess = DevExpress.Data.CustomSummaryProcess.Calculate Then
If (e.FieldValue.ToString <> "") Then
counter = counter + 1
End If
End If
' Save results
If e.SummaryProcess = DevExpress.Data.CustomSummaryProcess.Finalize Then
e.TotalValue = String.Format("{0}", counter)
End If
Catch ex As Exception
End Try
End Sub