Hi all,is there a way to validate the values that are inserted or updated in a new or existing row?
I got a UltraWinGrid bound to a BindingList<string>. I want to make sure no duplicate values are inserted or if a value is changed that it doesn't exist.
Playing around with the AfterRowUpdate/BeforeExit EditMode/BeforeRowUpdate but it just don't sort out.I cancelled these events but for example if I click into the "add new" row of the grid the item is immediately inserted without having the chance to validate anything.When catching the BeforeRowUpdate event and validating the value aginst the bound datasource I am not able to restore the previous value.
Is there a way to accomplish this? Maybe a HowTo?
thanks in advance and have a good daycheersAndy
Thanks a lot Mike ;)
All of the approaches you are using here seem valid to me. You could do this in BeforeCellUpdate, BeforeRowUpdate, or BeforeExitEditMode.
You would, of course, have to loop through all of the other rows, either in the data source or in the grid, to determine if the value already exists and be sure to ignore the current row that is being edited.
Regarding reverting to the original value when using BeforeRowUpdate, what you can do is set the RowUpdateCancelAction property on the grid.