I use the gridview's row validating event to perform some validations.
All database methods in my persistence framework are defined async. The validation method needs database access, so it's also defined as async and returns a Task<bool>.
The row validating event handler awaits this validation method. If the validation fails, the isValid property is set to false.
Everything works fine as long as there is no asynchronous database call and the code execution runs synchronously. As soon as I have real asynchronism, the grid view doesn't wait for the completion of the validating event handler anymore. It continues its internal validation and the RowEditEnded event raises - although the RowValidating event handler hasn't finished already.
How can I force the grid view to wait for the asynchronous validation? I know that there are some issues with events and the async/await pattern and I tried different declaration types - without success.
Thanks for you help!