This is a migrated thread and some comments may be shown as answers.

RadGrid Client Side CRUD with Client DataSource

3 Answers 228 Views
ClientDataSource
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 10 Oct 2015, 02:14 PM

Hi Team,

I want to implement add,edit,delete operations using radgrid bind to client datasource locally and commit changes ​to the remote server with the sync() command, meaning all crud operations will be done on the client-side and save changes to the remote server.

Any help will be much appreciated.

Thank you.

 

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 14 Oct 2015, 10:17 AM
Hi,

We have a demo showing such integration between RadGrid and RadClientDataSource. When the batch editing mode is enabled the clientDataSource will automatically handle all CRUD operations and call the sync() method when you click the "Save Changes" button in the grid, so no additional implementation on your side is required in this case, besides configuring the data source to call the right methods on the remote server.
Here is the demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx

Regards,
Marin
Telerik
0
Ali
Top achievements
Rank 1
answered on 15 Oct 2015, 09:19 PM

Hi Marin,

 Thanks for the feedback, I already know that but what I want to avoid is to repeatedly save changes to the remote server when the save changes button is click.

 Actually, what  I want to achieve is that, I have a form bind to its own RadClientdataSource and two RadGrid also bind to another RadClientDataSource respectively. All Changes should be save to each respective RadClientDataSource (that is locally). Then After completing the forms, there is one save all button (btnSaveAll) when clicked will save all the ClientDataSources to the remote server.

The reason been that, due to poor internet connection I want to give the user flexibility to work on the browser then save the data to the remote when internet connection is established.

 Thank You.

0
Marin
Telerik team
answered on 19 Oct 2015, 08:53 AM
Hello,

RadClientDatasource does not persist changes locally, it keeps an array of all the data items and their changed values, but by default this is not persisted anywhere until you call the update, insert or sync methods.
The same is valid for RadGrid even without pressing the "Save Changes" button internally it will still keep an collection of all the changed data and send it to the server after pressing the "Save Changes" button or calling the respective command on the client-side.
If the user's work on the browser does not involve any postback or page refresh then these arrays will keep the data until its sent to the server.
Otherwise a more custom solution might be required where you persisted these changes in some local storage in the browser, but this has to be done manually because the controls do not provide such option out of the box.

Regards,
Marin
Telerik
Tags
ClientDataSource
Asked by
Ali
Top achievements
Rank 1
Answers by
Marin
Telerik team
Ali
Top achievements
Rank 1
Share this question
or