I am using Blazor server, and as Michael DiFilippo suggested, i am using CommitEditsAsync method to save data. But this method save/accept data in grid.
How we can call web API or controller or c# code to save data in database. I am using EditModeType.CellBatch, and on SAVE button, like to start a db transaction and save all changes. So that either all save or nothing save.
I was OnDataCommitting method is invoked when we call CommitEditsAsync. But this method give one row at a time. Therefore cannot control transaction.
Is there any way, when click SAVE button, then all changes pass to web api/controller or c# code, so that we can start database transaction and save changes. Appreciate if there is a sample project.
Hello Himanshu,
Thank you for contacting Infragistics. This is a common question we get and because the grid does not talk directly to a database you'll require some adapter/api, as you pointed out, that connects your grid's datasource to the database. We don't have any solutions to provide as this will depend on your environment and falls outside of our area of support expertise. I suggest taking a look at this blog
blazorhelpwebsite.com/.../34
Thanks Michael for reply.
I am not asking how to write API or c# to save data.
My question is :
In Html.Infragistics, we have method .UpdateUrl(Url.Action("ControllerName")). And call our controller.
In Blazor grid, i am not finding any property/method that i can point to my API or controller. As i said "CommitEditsAsync" not having parameter to point to API URL.
Do i have to write OnDataCommitting and call API for each updated row?
Hello and thank you for following up. As mentioned in the previous update the datasource should be the one talking to your database and not the grid. You'll be cutting down performance if you try to hook one of our events. Instead you should keep track of when your collection is updated and perform the update.
see this discussionstackoverflow.com/.../cicular-database-update-on-collectionchanged-event