protected void dgSummary_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { ColumnTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Amount")); } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[6].Text = "Total Rs:"; // for the Footer, display the running totals e.Row.Cells[8].Text = ColumnTotal.ToString(); e.Row.Cells[8].HorizontalAlign = HorizontalAlign.Right; e.Row.Font.Bold = true; } } catch (Exception ex) { } }