在底下显示钱的合计

后台

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

前台


你可能感兴趣的:(在底下显示钱的合计)