asp.net Gridview里添加汇总行
if (e.Row.RowType == DataControlRowType.DataRow)
{
totalcash += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "cash"));
totalunbalanced += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "unbalanced"));
totalsettled += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "settled"));
}
else if(e.Row .RowType ==DataControlRowType .Footer )
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = totalcash.ToString("0.00");
e.Row.Cells[2].Text = totalunbalanced.ToString("0.00");
e.Row.Cells[3].Text = totalsettled.ToString("0.00");
e.Row.Font.Bold = true;
}
上一篇:.NET 2.0获取配置文件AppSettings和ConnectionStrings节数据的方法
栏 目:.NET代码
下一篇:C#用匿名方法定义委托的实现方法
本文地址:http://www.codeinn.net/misctech/50808.html