后台
protected void sgvFile_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
decimal AllMoney = 0;
foreach (DataRow dr in listDs.Tables[0].Rows)
{
AllMoney += Convert.ToDecimal(dr["Money"]);
}
e.Row.Cells[3].Style.Add("text-align", "right");
e.Row.Cells[3].Text = "合计(元): ";
e.Row.Cells[4].Style.Add("text-align", "right");
e.Row.Cells[4].Text = zhyFunctions.ShowNumberText(AllMoney, 2);
for (int i = 0; i < 11; i++)
{
if (i != 3 && i != 4)
{
e.Row.Cells[i].Text = "";
}
}
}
}
前台
<yyc:SmartGridView OnRowDataBound="sgvFile_RowDataBound" ShowFooter="true" >
网友评论