We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Is there an event thrown when the user abort adding a new row ?

Thread ID:

Created:

Updated:

Platform:

Replies:

125534 Aug 23,2016 11:17 AM Aug 24,2016 10:00 AM WPF 1
loading
Tags: SfDataGrid
Silvio
Asked On August 23, 2016 11:17 AM

Hi,

I have joined in a SfDatagrid the event AddNewRowInitiating and it works very well.

But I'm not able to find (if it exists) an event raised when the user decides to abort the new row insertion pressing the Esc key.
Is there the possibility to be advised by an event when such a situation occurs ?

Jai Ganesh S [Syncfusion]
Replied On August 24, 2016 10:00 AM

Hi Silvio, 
 
We have analyzed your query. You can use the below code to handle AddNewRow abort operation by override GridSelectionController. 
 
this.datagrid.SelectionController = new GridSelectionControllerExt(this.datagrid); 
 
public class GridSelectionControllerExt : GridSelectionController 
    { 
        public GridSelectionControllerExt(SfDataGrid datagrid) 
            : base(datagrid) 
        { 
 
        } 
 
        public override bool HandleKeyDown(KeyEventArgs args) 
        { 
            if (this.DataGrid.View.IsAddingNew && !this.DataGrid.SelectionController.CurrentCellManager.CurrentCell.IsEditing) 
            { 
                // Write your code here 
            } 
            return base.HandleKeyDown(args); 
        } 
    } 
 
 
Regards, 
Jai Ganesh S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;