Blazor DataGrid Example - Dialog Editing
Order ID | Customer ID | Freight | Order Date | Ship Country | Verified |
|---|
| 10001 | ALFKI | $2.30 | 5/15/1991 | Denmark | |
| 10002 | ANATR | $3.30 | 4/4/1990 | Brazil | |
| 10003 | ANTON | $4.30 | 11/30/1957 | Germany | |
| 10004 | BLONP | $5.30 | 10/22/1930 | Austria | |
| 10005 | BOLID | $6.30 | 2/18/1953 | Switzerland | |
| 10006 | ALFKI | $4.60 | 5/15/1991 | Denmark | |
| 10007 | ANATR | $6.60 | 4/4/1990 | Brazil | |
| 10008 | ANTON | $8.60 | 11/30/1957 | Germany | |
| 10009 | BLONP | $10.60 | 10/22/1930 | Austria | |
| 10010 | BOLID | $12.60 | 2/18/1953 | Switzerland | |
| 10011 | ALFKI | $6.90 | 5/15/1991 | Denmark | |
| 10012 | ANATR | $9.90 | 4/4/1990 | Brazil |
This sample demonstrates how to use dialog editing mode in the DataGrid to perform CRUD operations efficiently.
The Blazor DataGrid dialog editing feature enables you to edit the currently selected row data within a modal dialog. You can perform the following CRUD operations:
- Add - Click the Add toolbar button to create a new record.
- Edit - Double-click a row or click the Edit toolbar button after selecting a row to modify data.
- Delete - Click the Delete toolbar button after selecting a row to remove a record.
- Update - Click the Update toolbar button to save all edited changes.
- Cancel - Click the Cancel toolbar button to discard all edited changes.
CRUD operations in the DataGrid are configured using the GridEditSettings component. You must define at least one column as a primary key using the IsPrimaryKey property in the GridColumn component.
The available edit modes are:
- Inline - Edit records directly within the grid rows
- Batch - Edit multiple records with batch save capability
In this demo, dialog mode is enabled by setting the Mode property to Dialog in the GridEditSettings component. Begin editing by double-clicking a row or clicking the Edit button on the toolbar. A dialog will appear displaying the currently selected row, allowing you to modify row values and save the edited data to the datasource.
For more detailed information about dialog editing, refer to the dialog editing documentation.