This is a migrated thread and some comments may be shown as answers.

CellValidating, RowValidating, RowValidated events

0 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fabrizio
Top achievements
Rank 1
Fabrizio asked on 04 Jun 2019, 06:43 PM

Hello,

I contact you because I have 2 questions about the events of RagGridView control.

  1. I have 2 columns in my GridView (one GridViewTextBoxColumn readonly and one GridViewDecimalColumn editable). The decimal column can have a null value or a decimal value.
    I handle these events : CellValidating, RowValidating and RowValidated. In the CellValidating, I check if my decimal column has a value and in this case it must be between min and max value and display the Row.ErrorText and cancelling the validating event. However if the decimal value is null, I have to ask the user a confirmation when the row is validating, so I do that in the RowValidating event. If the user does not confirm, I cancel the RowValidating and I would like to set the decimal cell as the current cell and BeginEdit. Is it possible in the RowValidating event set a current cell and BeginEdit (in a new row or an existing row) ?
  2. In the GridView I register a custom GridNewRowBehavior and override the ProcessEscapeKey method that execute this code :
    bool canceled = this.GridViewElement.CancelEdit();
    this.GridControl.MasterView.TableAddNewRow.CancelAddNewRow();

    return canceled;       
    If the gridView is in edit mode on the new row or an existing row and I press the Escape key, my custom behaviour performs perfectly this treatment. But the RowValidating and RowValidated events in my form fires. How can I detect in these events that the edit mode is canceling because I would like to reset some properties ?

Thank you
Fabrizio

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Fabrizio
Top achievements
Rank 1
Share this question
or