Private total As Decimal = 0
Protected Sub gvPurchaseOrderDetail_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lblPrice As Label = DirectCast(e.Row.FindControl("lblPrice"), Label)
Dim price As Decimal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "UnitPrice")) * Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OrderQty"))
lblPrice.Text = price.ToString()
total += price
End If
If e.Row.RowType = DataControlRowType.Footer Then
Dim lblTotal As Label = DirectCast(e.Row.FindControl("lblTotal"), Label)
lblTotal.Text = total.ToString()
End If
End Sub