//declaring global variable
static int total=0;
// under gridview RowDataBound Event
if (e.Row.RowType == DataControlRowType.DataRow)
{
total = Convert.ToInt32(((DataRowView)e.Row.DataItem)["total"].ToString());
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label Label27 = (Label)e.Row.FindControl("Label25");
Label27.Text =total.ToString();
}
this is what worked for me :)