Aspxgridview 根据条件来自定义计算Totalsummery
1 protected void ASPxGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) 2 { 3 int totalSum = 0; 4 // Initialization. 5 //if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start) 6 totalSum = 0; 7 // Calculation. 8 //if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate) 9 if(((ASPxPageControl)grid.FindDetailRowTemplateControl(Eindex, "ASPxPageControl1"))==null)return; 10 for (int i = 0; i < ((ASPxGridView)((ASPxPageControl)grid.FindDetailRowTemplateControl(Eindex, "ASPxPageControl1")).FindControl("ASP xGridView1")).VisibleRowCount; i++) 11 { 12 if (Convert.ToString(((ASPxGridView)((ASPxPageControl)grid.FindDetailRowTemplateControl(Eindex, "ASPxPageControl1")).FindControl ("ASPxGridView1")).GetRowValues(i, new string[] { "XXX" })) == "False") 13 totalSum += Convert.ToInt32(((ASPxGridView)((ASPxPageControl)grid.FindDetailRowTemplateControl(Eindex, "ASPxPageControl1")). FindControl("ASPxGridView1")).GetRowValues(i, new string[] { "YYYY" })); 14 } 15 // Finalization. 16 //if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) 17 e.TotalValue = totalSum; 18 } 19 20 protected void grid_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e) 21 { 22 //if (e.Expanded) //判断是否是点击展开 23 //{ 24 // flag = true; 25 Eindex = e.VisibleIndex; 26 //} 27 }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。