欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp.net Gridview里添加汇总行

程序员文章站 2024-02-02 23:48:40
if (e.row.rowtype == datacontrolrowtype.datarow) { totalcash += convert.todecimal(data...

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