zoukankan      html  css  js  c++  java
  • GridView Footer页脚统计实现多行

    在使用GridView时有时会需要多行显示页脚Footer的统计,下面是一种解决方法,仅仅供各位参考

    在GridView的RowCreated事件中添加多行页脚,实例代码如下:

     1         protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
     2         {
     3             if(e.Row.RowType == GridViewRowType.Footer)
     4             {
     5                 Tuple<int, int> sum = IndexStatisticsDal.GetRecordSum(Convert.ToDateTime(ViewState["StartDate"]), Convert.ToDateTime(ViewState["EndDate"]), StatisticTypeEnum.REENTRYICU);
     6                 string resultStr = "&frasl;";
     7                 if (sum.Item2 > 0)
     8                 {
     9                     resultStr = ((double)sum.Item1 / sum.Item2 * 1000).ToString("0.0000") + "";
    10                 }
    11                 TableCellCollection footerRow = e.Row.Cells;
    12                 footerRow.Clear();
    13                 footerRow.Add(new TableCell());
    14                 footerRow[0].Text = "合计";
    15                 footerRow[0].Attributes.Add("rowspan", "2");
    16                 footerRow.Add(new TableCell());
    17                 footerRow[1].Text = sum.Item1.ToString();
    18                 footerRow.Add(new TableCell());
    19                 footerRow[2].Text = sum.Item2.ToString() + "</th></tr><tr class="C1FooterRow" style="font-size: 14px; font-weight: bold;">";
    20                 footerRow.Add(new TableCell());
    21                 footerRow[3].Text = "非预期重返重症医学科率";
    22                 footerRow.Add(new TableCell());
    23                 footerRow[4].Text = resultStr;
    24             }
    25         }
  • 相关阅读:
    储备学习drf的基本认知
    VUE基础一
    Django之outh模块
    MySQL模糊查询效率
    MySQL中位数计算方法
    1292
    正则表达式【UltraEdit / MySQL / 数据清洗】
    grep awk sed echo
    mysqldump备份工具使用
    shell的MySQL命令
  • 原文地址:https://www.cnblogs.com/lgx040605112/p/3313966.html
Copyright © 2011-2022 走看看