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

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

         protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == GridViewRowType.Footer)
{
Tuple<int, int> sum = IndexStatisticsDal.GetRecordSum(Convert.ToDateTime(ViewState["StartDate"]), Convert.ToDateTime(ViewState["EndDate"]), StatisticTypeEnum.REENTRYICU);
string resultStr = "&frasl;";
if (sum.Item2 > )
{
resultStr = ((double)sum.Item1 / sum.Item2 * ).ToString("0.0000") + "‰";
}
TableCellCollection footerRow = e.Row.Cells;
footerRow.Clear();
footerRow.Add(new TableCell());
footerRow[].Text = "合计";
footerRow[].Attributes.Add("rowspan", "");
footerRow.Add(new TableCell());
footerRow[].Text = sum.Item1.ToString();
footerRow.Add(new TableCell());
footerRow[].Text = sum.Item2.ToString() + "</th></tr><tr class=\"C1FooterRow\" style=\"font-size: 14px; font-weight: bold;\">";
footerRow.Add(new TableCell());
footerRow[].Text = "非预期重返重症医学科率";
footerRow.Add(new TableCell());
footerRow[].Text = resultStr;
}
}

GridView Footer页脚统计实现多行的更多相关文章

  1. 【转】GridView中页脚汇总显示

    来源:http://blog.csdn.net/atian15/article/details/3495514 有时候需要在GridView的页脚中汇总显示一些信息,常见的方法有两种: 1.在SQL中 ...

  2. 简单随笔——如何在gridview的页脚显示信息。。。。

    我是超级大菜鸟...哈哈 先上图看看是不是你需要的 第一步,右击gridview,在事件中,单击RowdataBond事件. 在这之前一定要记得在gridview属性中的ShowFooter设置为“t ...

  3. easyui datagrid footer 页脚问题

    mvc 的一个例子 public string IndexV2() { var dataGridJson = new DataGridJson(); var data = new List<My ...

  4. 雷林鹏分享:jQuery EasyUI 数据网格 - 创建页脚摘要

    jQuery EasyUI 数据网格 - 创建页脚摘要 在本教程中,我们将向您展示如何在数据网格(datagrid)页脚显示摘要信息行. 为了显示页脚行,您应该设置 showFooter 属性为 tr ...

  5. Android学习笔记_37_ListView批量加载数据和页脚设置

    1.在activity_main.xml布局文件中加入ListView控件: <RelativeLayout xmlns:android="http://schemas.android ...

  6. 使用Bootstrap 3开发响应式网站实践07,页脚

    页脚部分比较简单,把一个12列的Grid切分. <footer> <div class="container"> <div class="r ...

  7. Jquery EasyUI的datagrid页脚footer使用及数据统计

    最近做一个统计类的项目中遇到datagrid数据显示页脚footer合计的问题,对于构造统计结果数据格式,是在程序端构造一个{"rows":[],"total" ...

  8. bootstrap-table 页脚总计(自定义统计总数)

    •首先给table添加属性: showFooter: footer js代码如下: //初始化bootstrapTableinitBootstrapTable: function () { var o ...

  9. Sticky Footer (让页脚永远停靠在页面底部,而不是根据绝对位置)

    <!doctype html><html> <head> <meta charset="UTF-8"> <meta name= ...

随机推荐

  1. php处理字符串格式的计算公式

    有时候我们对每一种产品都有一个提成公式,而这个计算提成的公式是以字符串格式存在表中的 当我们用这个计算公式时,他并不像我们写的:$a=2+3*5;这样简单的能计算出结果,而它是个字符串 所以,我们就必 ...

  2. mysql优化 - mysql 的 hint

    FORCE INDEX 强制索引 只使用建立在field1上的索引,而不使用其它字段上的索引. SELECT * FROM table1 FORCE INDEX (field1) IGNORE IND ...

  3. ural 1192 Ball in a Dream

    #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> # ...

  4. curl 提交请求

    http://forums.phpfreaks.com/topic/194255-curl-sending-array-as-post-value/ http://www.cnblogs.com/ch ...

  5. linux下so动态库一些不为人知的秘密

    linux 下有动态库和静态库,动态库以.so为扩展名,静态库以.a为扩展名.二者都使用广泛.本文主要讲动态库方面知识.    基本上每一个linux 程序都至少会有一个动态库,查看某个程序使用了那些 ...

  6. UVa400.Unix ls

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  7. storm 事务和DRPC结合

    示例代码: package com.lky.topology; import backtype.storm.Config; import backtype.storm.LocalCluster; im ...

  8. Zookeeper为什么总是奇数个

    zookeeper有这样一个特性: [集群中只要有超过过半的机器是正常工作的,那么整个集群对外就是可用的] 也就是说如果有2个zookeeper,那么只要有1个死了zookeeper就不能用了,因为1 ...

  9. (转)iOS5:[UIDevice uniqueIdentifier]的替代方案

    背景: 大多数应用都会用到苹果设备的UDID号,UDID通常有以下两种用途: 1)用于一些统计与分析目的:[第三方统计工具如友盟,广告商如ADMOB等] 2)将UDID作为用户ID来唯一识别用户,省去 ...

  10. Java finally语句到底是在return之前还是之后执行(JVM字节码分析及内部体系结构)?

    之前看了一篇关于"Java finally语句到底是在return之前还是之后执行?"这样的博客,看到兴致处,突然博客里的一个测试用例让我产生了疑惑. 测试用例如下: public ...