The Best place for summation data is in the footer, that will take care of having the command controls as they are not added to the footer.
See: Displaying Summary Data in the Footer
Also: What is the XY Problem?
Example (should be easy to convert to C#):
'Note Global Declaration
Dim Total1 As Double = 0
Dim Total2 As Double = 0
Protected Sub GridView1_RowDataBound _
(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim drv as DataRowView = CType(e.Row.DataItem, DataRowView)
' Perform summations on Data rows
Total1 += CDbl(drv("<column_name>").ToString())
Total2 += CDbl(drv("<other_column_name>").ToString())
ElseIf e.Row.RowType = DataControlRowType.Footer Then
' Place results in footer cells
e.Row.Cells(2).Text = "Total: " & Total1.ToString()
e.Row.Cells(3).Text = "Total: " & Total2.ToString()
Endif
End Sub