how i can cancel the active cell edit mode through code?
currently I'm doing this when valid the active editor:
private void dgvTender_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
decimal validFormat = 0M;
bool isValidFormat = decimal.TryParse((string)e.Value, out validFormat);
e.Valid = false;
MessageBox.Show("El monto ingresado no tiene un formato valido",
Thank you for the question.
Use the View's HideEditor method to switch the current View from edit to browse mode.
If you need any further assistance on this subject, please feel free to reactivate this ticket.
I was trying but not work, always show the active cell as in edit mode
What I doing bad?
but, if I try this, work fine
Thank you for the feedback.
If I understand you correctly, you wish to prevent a particular grid cell's editor from being invoked after pressing the Enter key. Correct? If so, you can accomplish this task by handling the GridView.ShowingEditor event and setting the e.Cancel property to true, based on a particular condition in this event handler. Please review the How to Conditionally Prevent Editing for Individual Grid Cells help article for more information in this regard.
Does this solution meet your requirements? If not, please explain your task in greater detail. It will allow me to help you faster.
I'm trying to do...
I have a form with a gridview the objective the it is that user type a product code in the first cell, when it press the key enter validate the product code and if it exists pass to cell quantity, but, when the cursor pass to cell quantity, the gridview is in edit mode, if i apply the this code: gvFactura.CloseEditor() the gridview always remains in edit mode.
Why?... I find that when the property the gridview "OptionsNavigation.EnterMoveNextColumn" is true, the command CloseEditor() is ignored, but works well when it is false
Could this be a issue?, or is right to work this way?
Apologies if I did not understand right from the start, but do not speak much English.
Thanks for you help.
Thank you for the feedback.
The current behavior is by design.
Our documentation states:
"The EnterMoveNextColumn option defines the ENTER key behavior when a cell editor is active. If set to false, pressing the ENTER key results in closing the editor saving changes made. Otherwise, the ENTER key press additionally moves focus to the next row cell and activates its editor. Note that focus is moved even if the next cell cannot be edited."
So, first, the processed grid's cell is validated, then focus is moved to the next cell, and the corresponding cell's editor is invoked.
To accomplish this task, handle the GridView.KeyDown event, as shown in the attached project. Please review the attached project, and let me know if this solution helps you.
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.