I have a winform which has several UltraGrid on it. I have been doing cell validation in
OnBeforeExitEditMode() event. However, I am now in a situation that I have to validate based on values from more than one cells. So I have to perform validation after user has entered all the data for the entire row. Is there an event that captures row changes? OnBeforeExitEditMode() will not work since it is fired after every cell change. I tried
OnBeforeRowDeactivate() but this event does not fire when user clicks on another grid or close the form.
I am coding with Infragistics V9.1. Thanks.
The event you are looking for is BeforeRowUpdate.
Thanks for the response. According to my tests, BeforeRowUpdate() gets fired after every cell change. This will not work for me since, for example, I have a StartDate and EndDate in the row. I would like to verify that if user has entered StartDate, then EndDate cannot be null. So I need to validate at row level.
shsieh said:According to my tests, BeforeRowUpdate() gets fired after every cell change.
BeforeRowUpdate only gets fired when the row is changed, not the cell. Are you sure you are not hooking the BeforeCellUpdate event, instead?
If you are hooking BeforeUpdate and it's firing when you change a cell and then move to another cell in the same row, then my guess is that something in your code is forcing a row update.
I would like to react on this.
I have to update rows in a grid and it can be the case that I have only one row available in the grid.
The BeforeRowUpdate trigger will never be triggered in that situation and adjustments will not be validated and assigned to the datasource.
So data adjustments will not be send to the database server.
Same when the user adjust data on a row and not move to another record.
Is there an option to trigger the beforeRowUpdate from my source for example when I trigger a button on the menu?
And check if the validation was done correctly before I set the changed dataset back to the server including the adjustments the user was working on before pressed the button.
This will help a lot.
Kind Regards,
Peter
Hi Peter,
The grid commits the changes to the data source based on the UpdateMode property. By default, this means the grid will commit when the user leaves the row (which can't happen in a grid with only one row) or when the grid loses focus. So if there are any other controls on the form that take focus and the user clicks on any of those controls, the changes will be committed and the event(s) will fire.
If there are no other focusable controls, then you can force the changes to be committed via method calls.
You can call the Update method on a single row to commit the changes to that row only.
Or you can call the UpdateData method on the grid which will commit all rows.