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.

How to programatically cancel adding a new row

Thread ID:

Created:

Updated:

Platform:

Replies:

119550 Jul 7,2015 10:44 PM Jul 14,2015 12:04 PM WPF 3
loading
Tags: SfDataGrid
Brett Klopfer
Asked On July 7, 2015 10:44 PM

Hi,

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 04:46 AM

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.


Regards,

Jayaleshwari N.


Brett Klopfer
Replied On July 10, 2015 12:31 AM

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 12:04 PM

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.

Regards,

Jayaleshwari N.


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.

;