Hello All,
I am using the UltraGrid control along with the RowEditTemplate, I am populating the grid with data using the EntityFramework, everything seemed to be working just fine. The issue I am having is that when the row edit template is displayed and the user decides to click cancel, the changes are still committed to the datasource.
'This code was automatically generated by the RowEditTemplate Wizard'Close the template and discard any pending changes.
Me.UltraGridRowEditTemplate1.Close(False)
I have tried to trap the before and after row update events to see if they fire on .Close(False) and they don't they only fire on .Close(True) of the RowEditTemplate.
It looks that the 'commitChanges' is working when the changes needs to be committed to the row, but it will not when trying to discard these changes.
I am using the standard System BindingSrouce and the BindingNavigator (VS2008)
Hi,
I wanted to know the Done, Cancel bttton click events when user tries to add/cancel adding new row.
Thank you
Shirisha
aztech said:I have tried with out the RowEditTemplate and the result that I got was; when I change the cell value and I hit the Esc key it reverts back to its original value, but when I Edit the cells value and I move to the next cell (within the same row) and I hit the Esc key it does not revert to the original value.
Pressing the Esc key once cancels any pending edit in the active cell. Pressing it a second time cancels any pending edits in the entire active row. So you have to press it twice to do what you want to do here.
If pressing Esc twice in the grid (without the RowEditTemplate) doesn't work, then the most likely explanation is that there's an issue with your data source. It probably doesn't support canceling. I'm not an expert on the EntityFramework, but basically in order to cancel, the data source either has to implement ICancelAddNew or the items within the list have to implement IEditableObject.
Hello Mike,
Thank you for the prompt response to this thread. I have tried with out the RowEditTemplate and the result that I got was; when I change the cell value and I hit the Esc key it reverts back to its original value, but when I Edit the cells value and I move to the next cell (within the same row) and I hit the Esc key it does not revert to the original value.
I have tried to modify the UltraGrid.UpdateMode property to OnRowChange and other options I still get the same results. with and without the rowedittemplate.
I am not sure if the rollback is supported between UltraGrid and EntityFramework, as I looked at the detailes in the local samples application and everything seemed to be the same except that I am using the Entity Model (Entity Object for my data)
The Version of the Ultragrid is 9.2.20092.1003
Is it only the RowEditTemplate? What if you type a change into a grid cell and then press the Esc key twice. That should cancel the edit, also.