Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Adding rows to Blazor Data grid
posted

Hi team,

I have a datagrid whose datasource is bound to a List<SalesOrders>. What I would like to do here is

1) Add a new row to the grid and update the underlying database table when I click on some kind of commit/save button.

2) Update the database table when I update a cell value and click on some kind of commit/save button.

3) Remove a Row from the grid and update the underlying database table by deleting the corresponding row.

Thanks

Baba

Parents
  • 29065
    Offline posted

    Hello Baba, 

    Thank you for contacting Infragistics. The first thing to do is change your collection to an IList or ObservableCollection so it supports Add and RemoveAt methods to make your updates easier. Please review my sample attached. It demonstrates how to remove a record by updating the datasource. The same implementation can be applied when adding rows to the datasource via the Add method. The DataGrid doesn't currently support adding and removing records via the UI so as long as your database and collection is updated accordingly and in sync then the grid will push updates automatically. cell-editing.zip

Reply Children