Here is sample code:
Private total As Double = 0
Protected Sub gvSubscriptionShoppingCart
_RowDataBo
und(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow
Then
'4 here is the 0-based column index for subs-Price
Dim price As String = e.Row.Cells(4).Text
If Not String.IsNullOrEmpty(price
) AndAlso price <> " " Then
CalcTotal(price)
End If
End If
End Sub
Private Sub CalcTotal(ByVal _price As String)
Try
total += Double.Parse(_price, NumberStyles.Currency)
Catch ex As Exception
'error handling
End Try
End Sub
Protected Sub gvSubscriptionShoppingCart
_DataBound
(ByVal sender As Object, ByVal e As EventArgs)
'Set the TextBox value
txtSubTotal.Text = total.ToString("c")
End Sub
Code adapted from this article:
http://www.aspnettutorials.com/tutorials/controls/calculate-price-aspnet-vb.aspx