private decimal TotalSales = (decimal)0.0;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
TotalSales += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "amount"));
else if (e.Row.RowType == DataControlRowType.Footer)
//e.Row.Cells[1].Text = String.Format("{0:c}", TotalSales);
e.Row.Cells[1].Text = TotalSales.ToString();
}
No comments:
Post a Comment