Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
getting error on databinder.eval
Danish Habib
Apr 29 2015 3:30 PM
464
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Suddenly getting this error message on login process
I want to perform insert/update and delete on the same grid.