Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
Validate on entire row and keep focus on it if not valid
posted

Hi,

I use an ultrawingrid to enter some data. I have two kind of validations : some validations specific to fields and a validation on the row, which depends upon combination of several fields.

My problem : when the row is not valid, I want to keep the user in the row to force him to make it valid, else delete the row. How can I do that ?

 

For cell validation, I put my code in "BeforeExitEditMode" event and if not valid, e.Cancel = true. This keep the focus in the cell until changes or Escape. I want to have the same behavior but for the row.

First try : using "BeforeRowUpdate". This works nice for validation, but when doing e.cancel = true, the invalid row disapears and the user have to re-enter it from scratch.

 

Second try : using "BeforeRowDeactivate ". This works nice for validation, but doing e.cancel = true does nothing. The user can go outside the row, the "AfterRowUpdate" fired and the invalid row is saved to the database.

 

Third try : using "BeforeRowDeactivate " and code to keep the focus in the row setting the suspected invalid cell in edit mode. This works nice for validation, but focus goes out of the row immediatly.

I attached the source code. Some lines are commented for test purpose.

Thank you.

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

    Olivier Paquette said:
    First try : using "BeforeRowUpdate". This works nice for validation, but when doing e.cancel = true, the invalid row disapears and the user have to re-enter it from scratch.

    Set this:

    this.ultraGrid1.RowUpdateCancelAction = RowUpdateCancelAction.RetainDataAndActivation;

    Once you do this, setting Cancel to true in BeforeRowUpdate will make the row stay active.

    If that does not work, please post a complete sample project (in a zip file). It's very difficult to run a text file. :)

Reply Children
No Data