I am trying to add a footer to my grid. The GridBoundColumns are summed without a problem. However, when I try to get the Average of a GridCalculatedColumn (of averages), it fails on the DataBind with "TargetInvocationException was unhandled by user code", Exception has been thrown by the target of an invocation.
It works if I try the Sum or Max of the averages, but I need the average itself, or the average of the Totals for column 1 and 2.
(btw, what is a Custom GridAggregateFunction?)
Any suggestions?
It works if I try the Sum or Max of the averages, but I need the average itself, or the average of the Totals for column 1 and 2.
(btw, what is a Custom GridAggregateFunction?)
Any suggestions?
calc1 = New GridCalculatedColumn
calcCol1(0) = "MTD_Used"
calcCol1(1) = "MTD_Available"
With calc1
.HeaderText = "MTD %"
.UniqueName = "MTDP"
.DataFields = calcCol1
.Expression = "{0}/{1}*100"
.HeaderStyle.HorizontalAlign = HorizontalAlign.Right
.HeaderStyle.Wrap = True
.ItemStyle.HorizontalAlign = HorizontalAlign.Right
.DataFormatString = "{0:N2}%"
.Aggregate = GridAggregateFunction.Avg
.FooterAggregateFormatString = "{0:N2}%"
.FooterStyle.HorizontalAlign = WebControls.HorizontalAlign.Right
.FooterStyle.Font.Bold = True
End With
Table1.MasterTableView.Columns.AddAt(3, calc1)
Table1.DataBind()
Using Version 2008.3.1125.35
Rob