Can you please advice how to force on grid to commit all data during user input
like binding standard .NET controls in on DataSourceUpdateMode.OnPropertyChanged
What I'd like to archive is when eg user clicks checkbox, I'd like grid to update datasource (DataTable) and fire all events related (eg CellAfterUpdate, row formatting etc)
Is it a way to archive that ? Appreciate any tips...
Hi,
Just like a TextBox control, the grid cell has properties for SelectionStart and SelectionLength. So you will probably want to set the SelectionLength to 0 and the SelectionStart to the length of the current text in the cell after you enter edit mode.
Thanks both for your reply.
Generally it works but everytime I commit changes, and return back in edit mode current value is highlighted.
SO if I'd like to enter eg number 123, it allows me to enter 1, then 1 is replaced by 2, and then 2 by 3,
so at the end I can enter only 1 digit.
How can I deselect cell value when returning into edit mode and put cursor at the end of cell's value?
You can also use the grid.UpdateData method to commit all changes in all rows of the grid. Or you can use row.Update to commit changes to a single row.
Performance might be an issue, as Hristo mentioned. But more important than that, there's also the possibility of errors. For example, if the user is typing into a DateTime cell in the grid and they type a single character, such as the number "1", this is not a valid date. If you try to commit the changes at this point, it will raise an exception.
Hello ,
To achieve your goal you could handle OnCellChange event. This event is fired when a cell is in edit mode and its value is modified by user and put there the following code:
‘ use this row if you want to commit the changes
UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.CommitRow)
‘ use this row if you whant to return the grid in edit more
UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
But I do not recommend to do this, because it may cause performance issues.
Let me know if you have any further questions.