Data binding example of ProBindingSource and updatable Teler

Posted by victorche on 09-Dec-2019 14:38

Hello,

I am trying to looking for an example using ProBindingSource and Telerik RadGridView.

I found the following example. https://community.progress.com/community_groups/openedge_classroom/m/downloads/2816

But there is no on how to do update/delete/add records via ProBindingSource and RadGridView.

Can someone help me with an example with the ability to update the Customer table?

Regards,
Victor

Posted by Laura Stern on 27-Dec-2019 12:00

You either have to have the BindingSource’s AutoUpdate property set to true (or is it AutoSync?  Look it up.. I’m not at work to look).  Or you need to subscribe to the AddNew event of the BindingSource.  In there you would propagate the changes to your temp-table. Unless the changes are propagated to the data source, (the TT) they will not stick.  This is all documented in the GUI for .Net book.

Just as a general rule, I would also recommend binding to a query on your temp-table rather than to the DataSet since you’re only showing records from a single table.  Bind to a DataSet if you have multiple tables and you want to see them all in the grid hierarchically.  It’s a bit more efficient that way.

All Replies

Posted by victorche on 26-Dec-2019 07:45

Unfortunately, I haven't found a way to use ProBindingSource and Telerik RadGridView to update the table contents.

No one is using this?

Posted by Laura Stern on 26-Dec-2019 13:08

Can you be a little more specific?  Regardless of the BindingSource for the moment, what are the facilities of the grid itself for adding/deleting/updating records?  You need to base everything off of that.  The grid controls the interaction through its UI affordances, and then interacts with the BindingSource to communicate the changes to the back end.  Unfortunately, I am not that familiar with the grid itself.  But if you ask specific questions, I can probably help you.  

If on the other hand, if you want to make modifications in the underlying table and then just have them show up in the grid (I.e., not through user interaction with the grid but by hitting a button or something), you just make the changes and call Refresh or RefreshAll on the BindingSource, as with any other control.

Posted by Laura Stern on 26-Dec-2019 13:27

P.S., the BindingSource has an AddNew event which should fire if a row was added through the grid.  Similarly, I think there is a DeleteRow event.  The GUI for .NET book has documentation on all of this.

Updates might have to happen via grid events.  But again, it is interaction of the user with the grid that drives this.

Posted by victorche on 27-Dec-2019 09:37

Hi Laura,

Thank ypu for your answers! I'll try the events you suggested.

I'll try to explain.

For example, I connect to the sports2000 database. Then create a temporary tDep table like sports2000 table.department. Then I fill in the temporary table via ProDataSet. And then bind the filled table to ProBindignSource, which is associated with the RadGridView element. The AllowEditRow property for RadGridView is set to TRUE.

As a result, I get the data in RadGridView successfully.

Now I double-click to edit the Dep Name field in RadGridView for any record and change its contents.

Now I want to save the change by pressing Enter or just clicking on any area of the grid. But my change disappears and the old value is returned.

It seems like a simple operation, but I have not found an example for its implementation.

Posted by Roger Blanchard on 27-Dec-2019 11:37

Your changes would be in the TT. You would have to take care of saving those changes to the backend.

If you want to bind directly to the backend (not recommended) just use a query bound to the probindingsource.

Posted by Laura Stern on 27-Dec-2019 12:00

You either have to have the BindingSource’s AutoUpdate property set to true (or is it AutoSync?  Look it up.. I’m not at work to look).  Or you need to subscribe to the AddNew event of the BindingSource.  In there you would propagate the changes to your temp-table. Unless the changes are propagated to the data source, (the TT) they will not stick.  This is all documented in the GUI for .Net book.

Just as a general rule, I would also recommend binding to a query on your temp-table rather than to the DataSet since you’re only showing records from a single table.  Bind to a DataSet if you have multiple tables and you want to see them all in the grid hierarchically.  It’s a bit more efficient that way.

Posted by Laura Stern on 27-Dec-2019 16:16

P.S.  All the BindingSource events/properties are also doc’d in the Objects section of the ABL reference, perhaps with less detail there..  And I think there are 2 .Net books. The BindingSource is discussed in depth in one of them.

Re binding to a query, you can bind to the TOP-NAV-QUERY of a DataSet, if you don’t have another one.

This thread is closed