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

How to programatically cancel adding a new row

Thread ID:





119550 Jul 8,2015 02:44 AM UTC Jul 14,2015 04:04 PM UTC WPF 3
Tags: SfDataGrid
Brett Klopfer
Asked On July 8, 2015 02:44 AM UTC


I need to be able to cancel adding a new row programatically to achieve the same result as pressing the escape key twice to clear the row completely.

Using the EndEdit() method on SfDataGrid.SelectionController.CurrentCellManager works fine on an existing row which contained data, but doesn't appear to work on a new row.

Jayaleshwari N [Syncfusion]
Replied On July 9, 2015 08:46 AM UTC

Hi Brett,

Thank you for using Syncfusion Products.

We have analyzed your query “How to programatically cancel adding a new row” by using AddNewRowController and its methods. Due to its protection level, you could not use them directly, but you can achieve them by reflection. We have prepared a simple sample based on your requirement. You can download it from the following location.

Sample location : WPF

In the above sample, we have used two buttons – Cancel and Commit AddNewRow. You can get the AddNewRowController using reflection from GridModel. It has CancelAddNew and CommitAddNew methods. CancelAddNew reverts the edited value and cancel the AddNewRow to be added to grid. CommitAddNew commits the entered value and include AddNewRow to grid.
We already have a KB document related to this query. Please refer the following KB link for your reference.
KB link: http://www.syncfusion.com/kb/5099/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagrid

Please let us know if this solution helps you.


Jayaleshwari N.

Brett Klopfer
Replied On July 10, 2015 04:31 AM UTC

Thanks very much for your solution.

Is there future chance that these methods will be accessible directly rather than via reflection?

Jayaleshwari N [Syncfusion]
Replied On July 14, 2015 04:04 PM UTC

Hi Brett,

We have analyzed your requirement “To change the protection level of AddNewRowController”. We will change the accessibility of AddNewRowController class as public and these changes will be reflected in our upcoming release 2015 Volume 3.

Please let us know, if you have any other queries.


Jayaleshwari N.


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