I am using RadGridView to edit my business object. My business object implements IEditableObject interface. My requirements states each row should be edited, saved or cancelled only using buttons in that row(sort of like the behavior in asp.net's grid). I have looked at this post and this post:
http://www.telerik.com/forums/do-not-call-endedit-on-leaving-row
http://www.telerik.com/forums/gridview-cancel-endedit
and I have also achieved the endedit and cancel edit effect using the following code:
<Button Content="Save" CommandParameter="{Binding}" Command="telerik:RadGridViewCommands.CommitEdit"></Button>
<Button Content="Cancel" CommandParameter="{Binding}" Command="telerik:RadGridViewCommands.CancelRowEdit"></Button>
The problem is, the default behavior of the RadGridView calls EndEdit on my businessObject even when the user selects another row either using the keyboard or the mouse click, and in the EndEdit row event lifecycles, the only event that gets called before EndEdit on the IEditableObject is called is the Row_Validating event. So to cancel the action, that's probably the only event I where I can handle it and setting the isvalid to false. This seems to me like a hack and it interfere with the actual business object validation. Why isn't there a RowEditEnding event that we can use for canceling? Is there a more natural way of doing this beside handling the Row_Validating event? Also, what are all the events that will trigger the EndEdit for the row beside left mouse click? I would like to handle them all in the worse case scenario if there are no better way of doing this.
http://www.telerik.com/forums/do-not-call-endedit-on-leaving-row
http://www.telerik.com/forums/gridview-cancel-endedit
and I have also achieved the endedit and cancel edit effect using the following code:
<Button Content="Save" CommandParameter="{Binding}" Command="telerik:RadGridViewCommands.CommitEdit"></Button>
<Button Content="Cancel" CommandParameter="{Binding}" Command="telerik:RadGridViewCommands.CancelRowEdit"></Button>
The problem is, the default behavior of the RadGridView calls EndEdit on my businessObject even when the user selects another row either using the keyboard or the mouse click, and in the EndEdit row event lifecycles, the only event that gets called before EndEdit on the IEditableObject is called is the Row_Validating event. So to cancel the action, that's probably the only event I where I can handle it and setting the isvalid to false. This seems to me like a hack and it interfere with the actual business object validation. Why isn't there a RowEditEnding event that we can use for canceling? Is there a more natural way of doing this beside handling the Row_Validating event? Also, what are all the events that will trigger the EndEdit for the row beside left mouse click? I would like to handle them all in the worse case scenario if there are no better way of doing this.