GridView 在Footer加上自动求和行
2012-12-07 22:30
351 查看
ShowFooter="True" private double sum = 0;//取指定列的数据和,你要根据具体情况对待可能你要处理的是int protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex >= 0) { sum += Convert.ToDouble(e.Row.Cells[5].Text) } if (e.Row.RowIndex >= 0) { sum += Convert.ToDouble(e.Row.Cells[5].Text); } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[4].Text = "总价格为:"; e.Row.Cells[5].Text = sum.ToString(); e.Row.Cells[2].Text = "平均价格为:"; e.Row.Cells[3].Text = ((int)(sum / GridView1.Rows.Count)).ToString(); } }
相关文章推荐
- GridView 在Footer加上自动求和行
- GridView加入自动求和求平均值小计
- GridView加入自动求和求平均值小计
- GridView加入自动求和求平均值小计
- gridview自动求和及合并多列多行单元格
- GridView自动求和、求平均值小计
- GridView自动求和、求平均值小计[转]
- GridView加入自动求和求平均值小计
- GridView控件中自动求和、合并单元格和排序
- GridView加入自动求和求平均值小计?
- GridView加入自动求和求平均值小计[转]
- GridView1 footer求和
- ## GridView 布局:item设置的高度和宽度不起作用、自动适配列数、添加Header和Footer ##
- GridView加入自动求和求平均值小计
- GridView加入自动求和求平均值小计
- 在ASP.NET中自动给URL地址加上超链接
- 在ASP.NET中自动给URL加上超链接
- 在ASP.NET中自动给URL加上超链接
- css 限定GridView宽度并加上滚动条
- 类似xkzzz复制文章自动加上版权功能的实现