Rank: Member Groups: Member
Joined: 3/15/2009 Posts: 15
|
Dear Support, I try to test the Grid control. I have a command control to delete row. I display my records in the grid. I click on delete link it delete the row. cool very cool but I need to check the summition of one column. when I use the loop to read the record using the following code it sum the delete rows too!!
PerTotal = 0
For X = 0 To Grid1.RecordCount - 1 If Grid1.Items(X).Cells(2).Value <> "" Then PerTotal += Val(Grid1.Items(X).Cells(4).Value) End If Next
ex. the grid has 5 rows. the value of fourth column as the following 50, 20, 15, 5, 10. the total is 100. now delete the 2 rows with the values 20 and 5. and I change the last row value to be 30 the total must 50 + 15 + 30 = 95 but the total is 50 + 20 + 15 + 5 + 30 = 120 !!!! I do not why?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, It always does. The record is marked as deleted but it is still there. This way it will be possible for your code know what has been deleted, otherwise you will only know that an row has been deleted but has no way to find out what that row contained before it has been deleted. You can modify your code to check whether an item has been deleted and if it has been deleted, you then skip that row. The GridItem object provides a Deleted property for you to do that: http://doc.essentialobjects.com/library/1/eo.web.griditem.deleted.aspxThanks!
|