Hi,
I am summing a column in my DataGrid and displaying total at the
footer with the below piece of code
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
'Snip out the ViewCount
Dim ContributionWithHeld As Integer =
Convert.ToInt32(DataBinder.Eval(e.Item.DataItem,
"ContributionWithHeld"))
myTotalContributionWithHeld +=
ContributionWithHeld
ElseIf e.Item.ItemType = ListItemType.Footer Then
e.Item.Cells(20).Text = "Total: " & String.Format
("{0:#,###}", myTotalContributionWithHeld)
End If
and it works great and it dispaly the correct total when it binds the
data. But if I click on Edit row button in the grid then the Sum/Total
at the footer changes (deducts the value of that cell in that row from
the total). Looks like the the row that is in Edit mode is not being
taken into acount while summing the values.
Can some one help me with this how to change the above code or what I
else I need to do to display the Sum correct even if any of the rows
in Edit mode.
Also, the other thing I would like to be able to do is when a row in
Edit mode and as I change the value in the Cell that I would like
Sum , the Sum at the footer needs to be changed. May be I need to do
it under OnCellChange event but not sure where and how do I do it as I
never done this before.
Please help.
Thanks,
-L