zoukankan      html  css  js  c++  java
  • asp.net增加合计行

    protected void gvWorkOrder_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow) //检查是否为datarow
    {

    totalcash += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "cash")); 

    totalunbalanced += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "unbalanced")); 
    totalsettled += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "settled")); 
    } 
    else if(e.Row .RowType ==DataControlRowType .Footer ) 
    { 
    e.Row.Cells[0].Text = "合计"; 
    e.Row.Cells[1].Text = totalcash.ToString("0.00"); 
    e.Row.Cells[2].Text = totalunbalanced.ToString("0.00"); 
    e.Row.Cells[3].Text = totalsettled.ToString("0.00"); 
    e.Row.Font.Bold = true; 
    } 
    

      

                if (e.Row.RowType == DataControlRowType.DataRow) //检查是否为datarow
                {
                    //DateTime PlanStart = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "FName")); //取得数据
                    //if (PlanStart < DateTime.Parse(txtStartDate.Text))
                    //{
                    //    e.Row.BackColor = System.Drawing.Color.FromName("#FFCCCC"); //颜色突出显示
                    //}
                    double totalnum=0;
                    double totalMoney=0;
                    DataRowView drvBasicCountInfor = (DataRowView)e.Row.DataItem;
                    double inum = Convert.ToDouble(drvBasicCountInfor[6].ToString());//6是第5列的数字
                    //生成总计
                    //totalNumber += iNumber;
                    totalnum += inum;
                    Double imoney = Convert.ToDouble(drvBasicCountInfor[8].ToString());//6是第5列的数字
                    //生成总计
                    //totalmoneyNumber += imoneyNumber;
                    totalMoney += imoney;
    
                    //e.Row.Cells[0].Text = "总计:";
                    //e.Row.Cells[5].Text = string.Format("{0}", totalnum);
                    e.Row.Cells[6].Text = string.Format("{0:c}", totalMoney);
                    e.Row.Cells[8].Text = string.Format("{0:c}", imoney);
                }
    

      

  • 相关阅读:
    软件系统架构演变
    PL/SQL语法
    ambari安装指南
    手把手带你使用JS-SDK自定义微信分享效果
    微信公众平台无法使用支付宝收付款的解决方案
    php创建含文件夹的zip文件
    捣鼓TinyMCE 粘贴图片并上传+Django后台
    捣鼓TinyMCE粘贴图片并上传+Flask后台
    关于Java 中Integer 和Long对象 对比的陷阱(简单却容易犯的错误)
    Java东西太多,记录一些知识点
  • 原文地址:https://www.cnblogs.com/laojiefang/p/2533642.html
Copyright © 2011-2022 走看看