This is a migrated thread and some comments may be shown as answers.

Stop EndEdit on selected row changing

2 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 27 Apr 2014, 12:26 AM
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.

2 Answers, 1 is accepted

Sort by
0
Gavin
Top achievements
Rank 1
answered on 27 Apr 2014, 12:37 AM
By the way, I think this requirement is a common one because having the command buttons within each row forces the user to explicitly indicate the row that he/she wants to edit/cancel or save.  I have searched the forum and found multiple people with a similar requirement that struggle to make it work with RadGridView.  Please help!
0
Yoan
Telerik team
answered on 30 Apr 2014, 04:04 PM
Hi Gavin,

As it turns out, this functionality in not supported with the current implementation of RadGridView.

Don't hesitate to contact us if you have other questions.

Regards,
Yoan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Gavin
Top achievements
Rank 1
Answers by
Gavin
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or