I currently have a DBDG and Im trying to do some excel like summing in it. The problem is that the grid is ~300 x 200 cells so its quite large. When I would sum all of the columns the grid preformed very, very slowly.
I was able to pull these sums in from our Database and set the totaling row equal to the correct values, but I cant figure out a good way to keep this information current as users modify the grid.
Originally I thought of using the current cell changed event, and tracking the difference of a cell and adjusting the total accordingly, but drag and drop does not trigger this so those changes would not be reflected.
Is there a good way to do this? Is there a way to track what the selection''s source and destination cells are?
ADAdministrator Syncfusion Team March 7, 2005 02:55 PM
Try using SaveCellInfo to track the changes.
e.Style.CellValue will have the new value for the cell at e.RowIndex, e.ColIndex. You can get teh old value from grid[e.RowIndex, e.ColIndex].CellValue. You can adjust your sum''s by subtracting the olv value and adding the new value.
ADAdministrator Syncfusion Team March 7, 2005 03:06 PM
Sounds good. Just one more question.. which event would this go into?
but e didnt have any of the possible functions and I didnt see anything like
ADAdministrator Syncfusion Team March 7, 2005 04:40 PM
The event is grid.Model.SaveCellInfo.
ADAdministrator Syncfusion Team March 8, 2005 10:03 AM
>The event is grid.Model.SaveCellInfo.
I dont quite understand. I am working in VB.net and am trying to figure out what event / handler the code should go into.
When trying to create an event handler there is no ''grid'' item and when I use GridDataBoundGrid1 there is no option for grid, model, or savecellinfo. Additionally when I try to use Me.GridDataBoundGrid1.Model within an existing sub or event handler there is no option for .savecellinfo
Additionally I found the following sample of code, and while it pastes into the program just fine, there is no ''Handles ****'' after the declaration so the sub never runs.
Private Sub GridSaveCellInfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs)
If ((e.ColIndex > 0) AndAlso (e.RowIndex > 0) AndAlso LoadingForm = False) Then
Debug.WriteLine(Me.GridDataBoundGrid1((e.RowIndex - 1), (e.ColIndex - 1))) ''= System.Int32.Parse(e.Style.CellValue.ToString)
e.Handled = True
ADAdministrator Syncfusion Team March 8, 2005 11:34 AM
You use the AddHandler command to subscribe to this event in VB.
AddHandler me.GridDataBoudGrid1.Model.SaveCellInfo, addressof GridSaveCellInfo
Take a look at \Syncfusion\Essential Suite\18.104.22.168\Windows\Grid.Windows\Samples\Quick Start\VirtualGrid\VB to see some sample code.
ADAdministrator Syncfusion Team March 8, 2005 03:09 PM
>Try using SaveCellInfo to track the changes.
> e.Style.CellValue will have the new value for the cell at e.RowIndex, e.ColIndex. You can get teh old value from grid[e.RowIndex, e.ColIndex].CellValue. You can adjust your sum''s by subtracting the olv value and adding the new value.
Thanks for the help Clay, still one thing I must not be understanding. I have the following function that prints on a cell change (be it drag and drop or otherwise)
(Row,Col) = X old value = Y
except that I get the new value in both places.
Sub gridsavecellinfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs)
("(" & e.RowIndex.ToString() & "," & _ e.ColIndex.ToString() & _
") = " & _
e.Style.CellValue & _
" old value = " & _
Is there something wrong with how I copied the code or is there a better call to get the info?
ADAdministrator Syncfusion Team March 8, 2005 06:01 PM
No, you are not doing anything wrong. it turns out that in a GridDataBoundGrid, the DataSource has already been updated by the time this event is raised. Sorry for the wrong information.
But I think you can do what you want by using the DataTable.ColumnChanging event to cache teh old value. Here is a sample.