DevExpress GridView自定义Summary的算法
本帖最后由 rzt_tao 于 2017-3-6 15:45 编辑Devexpress Gridview提供的Summary只有简单的SUM,Avg,Count等,实际上有时候这并不能满足我们的需求,不用担心,DEV提供了这个事件CustomSummaryCalculate,可以自定义算法。以下是个简单的例子:private void gridview1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
{
if (((DevExpress.XtraGrid.GridSummaryItem)e.Item).FieldName=="PERCENTAGE")
{
double total =
Convert.ToDouble(colTotal.SummaryItem.SummaryValue);
double Obtained =
Convert.ToDouble(colObtained.SummaryItem.SummaryValue);
if (totalMarks != 0)
{
e.TotalValue = Obtained / total * 100;
}
else
{
e.TotalValue = 0;
}
}
}
页:
[1]