在使用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. Dapper试用简例

    1.选择3.5以上框架在新建项目中引用Dapper.dll. 2.在后台写代码,代码写出来后感觉以前学的都白学了. 3. using Dapper; using System; using Syste ...

  2. wifi钓鱼教程

    关于 <原创>想钓鱼必须还要有好竿wifi学习教程+软件下载地址修正 因为最近网盘维护 导致资源无法下载 今天早上开通下载服务了大家可以放心下载. 蹭网要低调不要炫耀 软件介绍:Wires ...

  3. VLC测试IPv4 IGMP/IPv6 MLD协议

    1 简述 VLC既可以充当流客户端,又可以充当流服务器,并且可以跨平台使用,是一款开源.免费的软件,基于GNU GPL许可证. 2 搭建组播服务器 第一步:运行程序后选择“媒体  串流”:第二步:通过 ...

  4. rownum的使用

    Oracle 提供了rownum,rownum是一个隐含的字段,默认从1开始. 取得前5条记录: 采用rownum进行分页查询: 需要使用三层嵌套查询来完成分页查询: 例如查询第三到第四条记录: se ...

  5. ural 1640 Circle of Winter

    这道题真的很无聊,就是找一个圆,至少有一个点在这个圆上,其他点不能在圆外,半径不定: #include <cstdio> #include <cstring> #include ...

  6. Cracking the coding interview--Q1.5

    原文 Implement a method to perform basic string compression using the counts of repeated characters. F ...

  7. 2015第24周四Spring事务4

    Spring配置文件中关于事务配置总是由三个组成部分,分别是DataSource.TransactionManager和代理机制这三部分,无论哪种配置方式,一般变化的只是代理机制这部分.     Da ...

  8. VS2013单元测试

    原文地址:http://www.luacloud.com/2014/vs2013-unit-test-generator.html 下载地址:http://visualstudiogallery.ms ...

  9. Beanstalkd(ubuntu安装)

    安装Beanstalkd # apt-get install beanstalkd Unubtu 开启beanstalkd的持久化选项 #vim  /etc/default/beanstalkd 把S ...

  10. oracle中 connect by prior 递归算法

    Oracle中start with...connect by prior子句用法 connect by 是结构化查询中用到的,其基本语法是: select ... from tablename sta ...