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

Detect when user cancels an insert

3 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 21 Jul 2017, 03:43 PM

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

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jul 2017, 09:43 AM
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.
0
Mark
Top achievements
Rank 1
answered on 26 Jul 2017, 08:20 AM

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.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Jul 2017, 08:35 AM
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.
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Mark
Top achievements
Rank 1
Share this question
or