Hi
I'm binding the Ultrawingrid to collection (List<Products>) Now am modifying the values in grid (for eg: price) and i have a save button in the form.
when clicking the save button, the changes in the grid to be saved to the database. How can i achieve this for Collection.
(For DataSet it's working fine)
Regards
Sam
Matt
Thanks .. It's working fine :)
-Sam
Hi Sam,
Have you heard about Linq to Sql or Entity Framework? Those are new frameworks from Microsoft that can do similar things like DataSet but work with objects instead.
Sam,
There's nothing really built into the grid for saving back to a database. In the case of the DataSet, it is the DataSet itself that maintains what has changed since the data was retrieved, and you use that to get what needs to be persisted back to the DB. In the case where you're using a List (side note: I recommend using a BindingList instead), there is nothing that keeps track of what has changed since the grid was initiallly bound. One solution would be to keep a flag in the grid's AfterRowUpdate event telling you that you need to persist a given row (and do the same for AfterRowsDeleted, AfterRowInsert, etc). The other solution would be to derive your own List (or BindingList) and implement some sort of mechanism for determining what has changed (i.e. when individual properties in the Products class change, or when an item is added or removed to the list).
-Matt