aspxgridview根据不同内容汇总数据

        int totalSum;

        protected void lggrdpcxx_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)

        {

            string yszt ;

            string ywzt ;

            string yxxs ;

            string sfqy ;

            if (lggrdpcxx.VisibleRowCount > 0)

            {

                yszt = e.GetValue("验收状态").ToString();

                ywzt = e.GetValue("业务状态").ToString();

                yxxs = e.GetValue("允许销售").ToString();

                sfqy = e.GetValue("是否启用").ToString();

                // Initialization.

                if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start)

                    totalSum = 0;

                // Calculation.

                if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate)

                    if (yszt == "合格" && ywzt == "入库完成" && yxxs == "是" && sfqy == "是")

                        totalSum += Convert.ToInt32(e.FieldValue);

                // Finalization.

                if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize)

                    e.TotalValue = totalSum;

            }

        }

你可能感兴趣的:(GridView)