RadGrid Client Side CRUD with Client DataSource

4 posts, 0 answers
  1. Ali
    Ali avatar
    7 posts
    Member since:
    Aug 2013

    Posted 10 Oct 2015 Link to this post

    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.

     

  2. Marin
    Admin
    Marin avatar
    1044 posts

    Posted 14 Oct 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ali
    Ali avatar
    7 posts
    Member since:
    Aug 2013

    Posted 15 Oct 2015 in reply to Marin Link to this post

    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.

  5. Marin
    Admin
    Marin avatar
    1044 posts

    Posted 19 Oct 2015 Link to this post

    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
Back to Top