Stop EndEdit on selected row changing

3 posts, 0 answers
  1. Gavin
    Gavin avatar
    8 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2014 Link to this post

    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. Gavin
    Gavin avatar
    8 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2014 Link to this post

    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!
  3. Yoan
    Admin
    Yoan avatar
    1215 posts

    Posted 30 Apr 2014 Link to this post

    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.
     
Back to Top