I am having problems with displaying the totals in the footer of a gridview. I am writing a page whereby users can enter comments and marks for an online photo competition.
The page has a details view to enter the comment and mark. Its has a details view where the photo is displayed. It has a gridview where the comments and marks that have been entered are displayed.
It works well - the details view allows comment and mark entry and the gridview show the comments and marks as they are entered. The problems are twofold. Firstly the total shows double the marks that should be displayed. Secondly, when you leave the page and then return later, you have to refresh the page before it will show the latest comment and mark even though it shows this immediately after entering the data.
Ive provided my code below:
Partial Class PhotoAlbum_PhotoDetails
Private TotalMarks As Decimal
Protected Sub DisplayComment_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles DisplayComment.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
TotalMarks += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Mark"))
View Complete Post