Set the ShowFooter="True" in GridView
double dTotal = new double[1, dsTest.Tables[0].Columns.Count];
for (int p = 0; p <= dsTest.Tables[0].Rows.Count - 1; p++)
{
for (int c = 1; c <= dsTest.Tables[0].Columns.Count - 2; c++)
{
dTotal[0, c] = dTotal[0, c] + Convert.ToDouble(dsTest.Tables[0].Rows[p][c]);
GridView.FooterRow.Cells[(c+1)].Text = dTotal[0, c].ToString())
}
GridView.FooterRow.Cells[1].Text = "Total ";
}
it's the sample code you can modify it with foreach statements for better performance.