Thursday, May 28, 2015

Binding Entries Back From GridView to Dataset

The Manage 2000 DAC architecture relies on strongly typed datasets to manage the movement of business object data between UniData and ASP.NET webcontrols.  The table adapters generated for the datasets handle the binding of data from dataset to the webcontrols very nicely.  There are not, however, any generated methods for Update, Change or Delete operations.

It is possible without an awful lot of code to handle the gridview row events and utilizing the strongly typed dataset methods move the data back into the dataset from the UI.

Here is the SoWebShipments page converted to use GridView controls in place of UltraWebGrid controls:


To move the data back into the dataset we just need to handle the RowUpdating event to move the data and then handle the RowUpdated event to tell the grid the we handled the problem with the missing Update Method on our table adapter. In order to support deleting rows we do the same exercise in the RowDeleted and RowDeleting events handlers.