For n = 0 To GridView2.Rows.Count - 1
totalpayment += Val(GridView2.Rows(n).Cells(4).Text)
totalred += Val(GridView2.Rows(n).Cells(9).Text)
Next
'Dim totalpayment As Double = Convert.ToInt64(dt.Compute("sum(PaymentAmt)", ""))
If GridView2.Rows.Count > 0 Then
GridView2.FooterRow.Cells(3).Text = "<b>Grand Total</b>"
GridView2.FooterRow.Cells(4).Text = Format(totalpayment, "<b>0.00</b>")
GridView2.FooterRow.Cells(8).Text = "<b>Grand Total</b>"
GridView2.FooterRow.Cells(9).Text = Format(totalred, "<b>0.00</b>")
End If
End If
If Request.QueryString("ete") = "1" Then
Response.ContentType = "application/ms-excel"
Response.AddHeader("Content-Disposition", "inline;filename=" & rptName & ".xls")
End If