Prevent leave a row in DataGrid when has invalid data

May 17, 2011 at 12:14 AM


I'm creating a solution that uses a DataGrid when the user can update or create items. I need to validate some fields before the user save the data, i'm using the RowEditEnding event and in the case that the data has some field invalid, i show a message to the user and set the e.Cancel = true in the event to prevent the user leave the row. The problem is that the row change after the event, it's something like i didn't set e.cancel = true, and i need to force the user to stay in the row and solve the error before leave the row and submit the data to the DB.

Can anybody help me please?