We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Keeping totals current

Thread ID:

Created:

Updated:

Platform:

Replies:

25780 Mar 7,2005 02:47 PM Mar 8,2005 06:01 PM Windows Forms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 7, 2005 02:47 PM

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On March 7, 2005 03:06 PM

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

Administrator [Syncfusion]
Replied On March 7, 2005 04:40 PM

The event is grid.Model.SaveCellInfo.

Administrator [Syncfusion]
Replied On 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 ''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

Administrator [Syncfusion]
Replied On 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\3.0.1.0\Windows\Grid.Windows\Samples\Quick Start\VirtualGrid\VB to see some sample code.

Administrator [Syncfusion]
Replied On 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) 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?

Administrator [Syncfusion]
Replied On 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. http://www.syncfusion.com/Support/user/uploads/GDBG_SaveCellInfo_da6c10ef.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;