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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Canceling an Add new row operation

Thread ID:





121236 Nov 21,2015 12:04 AM UTC Nov 24,2015 11:23 AM UTC WPF 3
Tags: SfDataGrid
Alessandro Del Sole
Asked On November 21, 2015 12:04 AM UTC

I handle the AddNewRowInitiating event to detect when the user is adding a new item to a SfDataGrid. Supposing I detect the item being added is invalid for some reasons, is there a way to programmatically cancel the insert operation?

Thanks in advance,

Sivakumar R [Syncfusion]
Replied On November 23, 2015 03:57 AM UTC

Hi Alessandro,

You can validate the AddNewRow by handling RowValidating event of SfDataGrid. If you want to cancel the AddNew operation by validating, then you can use the below code to achieve your requirement,

using Syncfusion.UI.Xaml.Grid.Helpers;
this.dataGrid.RowValidating += dataGrid_RowValidating;

void dataGrid_RowValidating(object sender, RowValidatingEventArgs args)


    if (this.dataGrid.IsAddNewIndex(args.RowIndex))


        //Code for cancelling AddNew operation by validating the args.RowData

        if (this.dataGrid.SelectionController.CurrentCellManager.CurrentCell.IsEditing)


        var AddNewRowController = this.dataGrid.GetGridModel().AddNewRowController;



Refer the below KB, if you are using below 13.3 version to reflect and cancel AddNew operation.


Alessandro Del Sole
Replied On November 23, 2015 05:20 PM UTC

Thank you, really helpful reply!

Sowndaiyan Paulpandi [Syncfusion]
Replied On November 24, 2015 11:23 AM UTC

Hi Alessandro,

Thanks for your update.

Please let us know if you need any other assistance.




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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon