Thank you for the message.
To catch the moment when an end-user clicks the Escape key, handle the GridControl.EditorKeyDown or RepositoryItemLookUpEdit.KeyDown event. To access an active editor and its old edit value, use the GridView.ActiveEditor and BaseEdit.OldEditValue properties respectively.
Private Sub gridControl1_EditorKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) If e.KeyData = Keys.Escape Then ' End If End Sub
Please let me know if you need any further assistance.
can you please tell me which event is the correct one to use to update a database after the user has updated the RepositoryItemLookUpEdit dropdown? it appears that EditValueChanged is unreliable since it does not fire all the time (for example when the ESC key is pressed). so what is the right way to apply changes only after the user has finished editing and left the editor (only if he made a change)?
You can handle the GridView.CellValueChanged event . This event is raised after an end-user changes a cell's value and closes an in-place editor (for instance, by focusing another row/column).
Private Sub gridView1_CellValueChanged(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) If e.Column.FieldName <> "FirstName" Then Return End If ' End Sub
Also, you can perform data updates in the GridView.RowUpdated event . This event is raised after the modified focused row is saved to the underlying data source.
I recommend that you review the Posting Data to a Connected Database help article, containing useful information in this regard.
Please try this approach, and let me know your results.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.