I have table some of the columns having integer values and some rows are empty when i am using that code to show the sum of a specific column it gives error because it find a row with nothing and this column is integer type below is the code i have tried many option no one work for me ..
Private Sub grdUserReports_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdUserReports.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim rowTotal As Integer = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Target"))
If rowTotal <> 0 Then
grdTotal = grdTotal + rowTotal
End If
End If
If e.Row.RowType = DataControlRowType.Footer Then
Dim lbl As Label = DirectCast(e.Row.FindControl("lblTotal"), Label)
lbl.Text = grdTotal.ToString("c")
End If
End Sub