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 }
年轻过得闲,以后被人嫌...
年轻累不死....