当前位置:Gxlcms > asp.net > asp.net Gridview里添加汇总行

asp.net Gridview里添加汇总行

时间:2021-07-01 10:21:17 帮助过:11人阅读

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;
}

人气教程排行