Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to implement a capability to cancel current row modifications at the GridView level

$
0
0

WinForms binding provides a capability to discard modifications made in a current item. As it is stated in the MSDN, this feature is supported only if objects contained by the datasource implement the IEditableObject interface: CurrencyManager.CancelCurrentEdit Method.

Entity Framework 4 comes with POCO support allowing developers to define entities without requiring base classes. However, giving up inheriting from framework base entities developers lost built-in implementations of interfaces required in WinForms binding: IEditableObject and INotifyPropertyChanged. The lack of these interfaces implementation in entities causes loosing a corresponding functionality in data aware controls. For instance, the capability to cancel changes in GridView after validation failes.

There are many workarounds for this problem. This example demonstrates how to address the issue at the GridControl level without affecting other code. In this example, we create a GridView descendant according to recommendations provided in the How to create a GridView descendant class and register it for design-time use Knowledge Base article. The extended GridView uses the new data controller inherited from the CurrencyDataController and extended with a new feature by overriding several methods: BeginCurrentRowEdit, EndCurrentRowEdit, and CancelCurrentRowEdit.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>