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?
Thanks
AD
Administrator
Syncfusion Team
March 7, 2005 07:55 PM UTC
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.
AD
Administrator
Syncfusion Team
March 7, 2005 08:06 PM UTC
Sounds good. Just one more question.. which event would this go into?
I tried
GridDataBoundGrid1_CurrentCellChanged(...)
but e didnt have any of the possible functions and I didnt see anything like
GridDataBoundGrid1_SaveCellInfo
Thanks
AD
Administrator
Syncfusion Team
March 7, 2005 09:40 PM UTC
The event is grid.Model.SaveCellInfo.
AD
Administrator
Syncfusion Team
March 8, 2005 03:03 PM UTC
>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
''Me._extData
Debug.WriteLine(Me.GridDataBoundGrid1((e.RowIndex - 1), (e.ColIndex - 1))) ''= System.Int32.Parse(e.Style.CellValue.ToString)
e.Handled = True
End If
End Sub
AD
Administrator
Syncfusion Team
March 8, 2005 04:34 PM UTC
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\3.0.1.0\Windows\Grid.Windows\Samples\Quick Start\VirtualGrid\VB to see some sample code.
AD
Administrator
Syncfusion Team
March 8, 2005 08:09 PM UTC
>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)
System.Diagnostics.Debug.WriteLine
("(" & e.RowIndex.ToString() & "," & _ e.ColIndex.ToString() & _
") = " & _
e.Style.CellValue & _
" old value = " & _
Me.GridDataBoundGrid1(e.RowIndex, e.ColIndex).CellValue)
Is there something wrong with how I copied the code or is there a better call to get the info?
AD
Administrator
Syncfusion Team
March 8, 2005 11:01 PM UTC
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.
http://www.syncfusion.com/Support/user/uploads/GDBG_SaveCellInfo_da6c10ef.zip