在使用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. iOS开发——C篇&动态内存分配

    再C语言中关于内存是一个很重要的知识点,所以今天我就从c语言的内存分配开始为大家解析一下C语言再iOS开发中非常重要的一些知识. 1:malloc函数的介绍 C语言中开辟内存空间:malloc函数 再 ...

  2. jQuery CSS3 照片墙

    <html> <head> <style type="text/css"> .picture-wall-container{ position: ...

  3. Android 拨号器的实现 [视频1]

    Android自带了拨号功能和拨号器 这个是在一个视频里看到的    想写下来记录一下 下面放源代码 /hehe/res/layout/activity_main.xml <RelativeLa ...

  4. 转:CFile.Open()的使用说明

    在程中碰到这个一段代码: 讲的是CFILE类的文件操作,故参考MSDN系统学习一下(翻译了一下英文): CFile file;CFileException fe; //打开文件if(!file.Ope ...

  5. Attach file to database

    D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA databaseName.mdf databaseName.l ...

  6. android 截取指定位置字符串

    String str = "s\ziyuan"; String newStr = str.subString(str.indexOf("\\"),str.len ...

  7. SDL音频播放

    gcc -o tutorial03 tutorial03.c -lavutil -lavformat -lavcodec -lz -lm \`sdl-config --cflags --libs` A ...

  8. iOS越狱开发手记 - iOS9.3 dyld_decache不能提取arm64的dyld的解决方法

    参考以下文章 http://iosre.com/t/when-dyld-decache-fails-on-dyld-shared-cache-arm64-dsc-extractor-saves-our ...

  9. google官方提供的下拉刷新控件SwipeRefreshLayout

    摘自:http://www.stormzhang.com/android/2014/03/29/android-swiperefreshlayout/ SwipeRefreshLayout Swipe ...

  10. HDU 5506 - BestCoder Round #60 - GT and set

    题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1003 题意 : 给N集 ...