Detect when user cancels an insert

4 posts, 0 answers
  1. Mark
    Mark avatar
    36 posts
    Member since:
    Jan 2012

    Posted 21 Jul 2017 Link to this post

    Is there any way to detect/is there an event raised when a user cancels an insert?

    When the user clicks to enter data on the new row, pressing escape twice or clicking off the row twice cancels the insert and reinstates the "click here to enter a new row" banner.

     

    Is there anyway to detect when this happens?

     

    I am trapping when a user starts an insert, and also trapping the AddedNew event to detect when the user completes an insert but also need to know when they choose to cancel one.

    Many thanks,

    Mark

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3532 posts

    Posted 24 Jul 2017 Link to this post

    Hello Mark, 

    Thank you for writing.  

    RadGridView manages user mouse and keyboard input over its rows by GridRowBehavior. Depending on the row type, RadGridView introduces different behaviors, listed in the following help article: http://docs.telerik.com/devtools/winforms/gridview/rows/row-behaviors

    As it is demonstrated in the documentation you can replace the default behavior for the GridViewNewRowInfo and override the ProcessEscapeKey method in order to detect the cancel operation.

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Mark
    Mark avatar
    36 posts
    Member since:
    Jan 2012

    Posted 26 Jul 2017 Link to this post

    Hi,

    Thanks for getting back to me, and this is really handy to know.

    There are though other ways that the insert can be cancelled (escape key, clicking off the row, clicking off the grid, etc.) so I would be wary of trying to capture all the ways an insert can be cancelled.

    Is there an event that fires when the insert is cancelled, so effectively when the "click here to insert a new row" banner is restored?

    Thanks,

    Mark.

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3532 posts

    Posted 27 Jul 2017 Link to this post

    Hello Mark, 

    Thank you for writing back. 
     
    There is no dedicated event which is fired when the user cancels the new row. If you fill at least one cell in the new row and then click another row, the new row will be added to the grid. The UserAddedRow event will be fired. However, if you are in the new row and don't edit any cell and just clicks another row, only the current row is changed. The CurrentRowChanged event may be suitable for your case.  

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top