GridView添加统计(合计)行
2009-04-01 19:19
260 查看
Code
decimal totalstock = 0;
protected void GridView2_DataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
totalstock += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "total"));
// totalstock += DataBinder.Eval(e.Row.DataItem, "total");
//在这里就可以实现总和的计算了
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[2].Text = "合计:";
e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right;
e.Row.Cells[3].Text = totalstock.ToString();
}
}
decimal totalstock = 0;
protected void GridView2_DataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
totalstock += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "total"));
// totalstock += DataBinder.Eval(e.Row.DataItem, "total");
//在这里就可以实现总和的计算了
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[2].Text = "合计:";
e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right;
e.Row.Cells[3].Text = totalstock.ToString();
}
}
相关文章推荐
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计(合计)行
- GridView添加统计行 [转帖]
- GridView中添加最底层统计数据
- .net开发笔记之十二:在Datagrid控件中添加统计(合计)行
- Sql Server 给表添加合计并统计金额的存储过程!(源代码分享)
- GridView添加合计行的实现方案
- .net开发笔记之十二:在Datagrid控件中添加统计(合计)行
- GridView页脚添加合计字段的两种方法
- C#中如何给GridView添加页脚以实现统计某一列值的和
- 在GridView中添加一行(新行) 如统计信息等
- 为Gridview 添加合计和导出为excel