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);
                }
    

      

  • 相关阅读:
    2021秋9月14日
    向GitHub上传代码
    8.2.py 知识图谱
    7.2.py 树模型衍生变量
    3.3.py 迁移学习
    1.3.py CART回归树做组合规则特征
    2.7.py xgboost版评分映射
    特征重要性之shap value
    特征重要性之排列重要性Permutaion Importance
    Python 合并一个Excel文件中格式一样的sheet
  • 原文地址:https://www.cnblogs.com/laojiefang/p/2533642.html
Copyright © 2011-2022 走看看