码迷,mamicode.com
首页 > 其他好文 > 详细

Gridview里添加合计行

时间:2014-06-26 20:01:11      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   tar   ext   

ShowFooter="true"

double YG_DYYGSR_BHS = 0;
        double YG_DYKPSR_BHS = 0;
        double YG_DYSRHJ_BHS = 0;
        protected void gvIncomeYG_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            for (int i = 0; i < gvIncomeYG.Rows.Count; i++)
            {
                Label lblYG_DYYGSR_BHS = ((Label)gvIncomeYG.Rows[i].Cells[18].FindControl("YG_DYYGSR_BHS"));
                Label lblYG_DYKPSR_BHS = ((Label)gvIncomeYG.Rows[i].Cells[19].FindControl("YG_DYKPSR_BHS"));
                Label lblYG_DYSRHJ_BHS = ((Label)gvIncomeYG.Rows[i].Cells[20].FindControl("YG_DYSRHJ_BHS"));

                YG_DYYGSR_BHS += Convert.ToDouble(lblYG_DYYGSR_BHS.Text.ToString());
                YG_DYKPSR_BHS += Convert.ToDouble(lblYG_DYKPSR_BHS.Text.ToString());
                YG_DYSRHJ_BHS += Convert.ToDouble(lblYG_DYSRHJ_BHS.Text.ToString());
            }
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[0].Text = "合计";
                e.Row.Cells[18].Text = YG_DYYGSR_BHS.ToString("0.00");
                e.Row.Cells[19].Text = YG_DYKPSR_BHS.ToString("0.00");
                e.Row.Cells[20].Text = YG_DYSRHJ_BHS.ToString("0.00");
            }
        }

 

Gridview里添加合计行,布布扣,bubuko.com

Gridview里添加合计行

标签:style   class   blog   code   tar   ext   

原文地址:http://www.cnblogs.com/ZXdeveloper/p/3808289.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!