I am making my ultragrid editable. I was wondering what is the best way to handle user change. I thought of using BeforeRowUpdate, BeforeRowDelete, BeforeRowInsert to call the appropriate service to save the changes.
Is that a good way to proceed or there is a better way to do it?
It depends what you mean buy "handle user edit". Typicallyin a DotNet WinForms application, everything is done in batch. So you would provide the user with a Save button or prompt them to save when the form is closed and then save all the data to the back end at once.
You would not use any of the "Before" events to save data, because these events occur before the grid has written to the underlying data source. All of this also depends on what kind of data source you are using.
Ok, but I want that when the user modify something and leave the row to another row, it will ask the user to save or not to save. So that's why i thought of using the before...... but should I use Afterxxxxx??? instead
GoDaddy said: Ok, but I want that when the user modify something and leave the row to another row, it will ask the user to save or not to save. So that's why i thought of using the before...... but should I use Afterxxxxx??? instead
Okay.. there are three layers here. The first layer is the grid. The second is the grid's DataSource. The third is the actual database. The grid does not deal with the database layer at all - it only deals with it's local data source.
So the question is, when do you want to show this confirmation dialog? If you do this in the BeforeRowUpdate, then you could show a dialog to the user and allow them to cancel updating from the grid to the underlying data source. So in that case, you are right, you would need to use a Before event, because After would be too late.