Gridview求和,求平均数,非常简单实用
来源:互联网 发布:js date获取日期 编辑:程序博客网 时间:2024/05/01 22:26
- protected void _gvGuest_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- int count = _gvGuest.Rows.Count;
- if (e.Row.RowIndex >= 0)
- {
- sumRoom += Convert.ToDouble(e.Row.Cells[5].Text);
- sumJe += Convert.ToDouble(e.Row.Cells[6].Text);
- sumNgtKey += Convert.ToDouble(e.Row.Cells[7].Text);
- sumDyKey += Convert.ToDouble(e.Row.Cells[8].Text);
- sumResvNum += Convert.ToDouble(e.Row.Cells[9].Text);
- sumCZL += Convert.ToDouble(e.Row.Cells[10].Text);
- sumRevper += Convert.ToDouble(e.Row.Cells[11].Text);
- sumPJFJ += Convert.ToDouble(e.Row.Cells[12].Text);
- }
- else if (e.Row.RowType == DataControlRowType.Footer)
- {
- e.Row.Cells[5].Text = "汇总房间数:" + sumRoom.ToString();
- e.Row.Cells[6].Text = "汇总房金:" + sumJe.ToString();
- e.Row.Cells[7].Text = "汇总过夜房:" + sumNgtKey.ToString();
- e.Row.Cells[8].Text = "汇总日房:" + sumDyKey.ToString();
- e.Row.Cells[9].Text = "汇总使用房间数:" + sumResvNum.ToString();
- e.Row.Cells[10].Text = "平均出租率:" + (sumCZL / count).ToString("0.00") + "%";
- e.Row.Cells[11].Text = "平均Revpar:" + (sumRevper / count).ToString("0.00") + "%";
- e.Row.Cells[12].Text = "平均房价:" + (sumPJFJ / count).ToString("0.00") + "%";
- }
- }
补充说明:
①GridView的ShowFooter="true"
②颜色:<HeaderStyle Font-Bold="True" ForeColor="Black" HorizontalAlign="Center" />
<FooterStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Center" />
③GridView的OnRowDataBound="_gvGuest_RowDataBound"
0 0
- Gridview求和,求平均数,非常简单实用
- Gridview求和,求平均数,非常简单实用
- 求和求平均数
- awk 求和求平均数
- 求平均数的简单方法
- Sql查询技巧:联合查询,求和,求平均数等。
- GridView 简单实用demo
- 求平均数
- 求平均数
- 求平均数
- 求平均数
- 求平均数
- 非常实用的GridView.PagerTemplate 属性
- Gridview 使用方法大全----非常实用方法
- 时间插件 非常简单实用
- java 求和,平均数
- 求和与平均数
- 数组求和与平均数
- Android动画之Translate
- php wampserver的多站点配置
- STM8S003F使用I/O口模拟串口(一)发送数据
- 狂刷Android范例之4:用代码安装卸载app
- 25题~~字符串中找数字串
- Gridview求和,求平均数,非常简单实用
- 一个小型字符串工具类MString
- 缓存原理解析
- 在Spring中通过EasyUI的dialog创建登录界面
- Mike and Feet(CF 547B)
- 第三章 第四十四题
- uva 11552 Fewest Flops 线性dp
- iOS GCD 之dispatch_group方面的开发
- ThinkPHP 3.2.3 学习(1)