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. Image for the cookie policy date
close icon

Order of Events

It would be useful if you could include in your documentation something about the order in which Grid Events occur. I have one specific question/problem: I''m using Grid beta 2. I want to know about a change to the value of a cell as soon as it happens, not when the user has moved to another cell. I''ve hooked up to the Grid CurrentCellChanged Event In the handler for that event I examine the current value of the cell that has changed. ( eg with code like _grid[_grid.CurrentCell.RowIndex, _grid.CurrentCell.ColIndex].CellValue) However, the value returned is not the new value but the value but the value before a change was made. For instance, if I select a value from a drop down list, the change event is fired, but the value in the current cell is the previous item that was selected, not the current value. Hope you can help with this Sam

3 Replies

AD Administrator Syncfusion Team March 15, 2004 03:09 PM UTC

In CurrentCellChanged, you should get the current value from the cell renderer.ControlText. When a cell is actively being edited, the value is only known at the level of the cell control. It is not known at the grid level until you leave the cell. Dim newValue As string = Me.Grid.CurrentCell.Renderer.ControlText


SJ Samuel Jack March 16, 2004 08:17 AM UTC

What about if cells are changed by another means - programatically, or by pasting in values (which I guess is programatically). Would the CellsChanged event be raised in that case, rather than CurrentCellChanged? Were would I find these new values?


AD Administrator Syncfusion Team March 16, 2004 09:15 AM UTC

If you are typing into a cell, CellsChanging and CellsChanged are only fired when you leave the cell. In CellChanging, you can get the cell that is changing from e.Range. You can get the new value from e.CellsInfo. If you are pasteing, the event is fired for every cell, so the new value will be e.CellsInfo[0].CellValue. But in some circumstances (maybe if you are programatically calling ChangeCells), then e.CellsInfo will have multiple values in it as will e.Range. In CellChanged, the new value is already set into the grid, so you would get it there.

Loader.
Live Chat Icon For mobile
Up arrow icon