Blazor DataGrid Example - List Data Binding
Order ID | Customer ID | Order Date | Freight | Shipped Date | Ship City |
|---|
| 10001 | ALFKI | 5/15/1991 | $2.30 | 7/16/1996 | Berlin |
| 10002 | ANATR | 4/4/1990 | $3.30 | 9/11/1996 | Madrid |
| 10003 | ANTON | 11/30/1957 | $4.30 | 10/7/1996 | Cholchester |
| 10004 | BLONP | 10/22/1930 | $5.30 | 12/30/1996 | Marseille |
| 10005 | BOLID | 2/18/1953 | $6.30 | 12/3/1997 | Tsawassen |
| 10006 | ALFKI | 5/15/1991 | $4.60 | 7/16/1996 | Berlin |
| 10007 | ANATR | 4/4/1990 | $6.60 | 9/11/1996 | Madrid |
| 10008 | ANTON | 11/30/1957 | $8.60 | 10/7/1996 | Cholchester |
| 10009 | BLONP | 10/22/1930 | $10.60 | 12/30/1996 | Marseille |
| 10010 | BOLID | 2/18/1953 | $12.60 | 12/3/1997 | Tsawassen |
| 10011 | ALFKI | 5/15/1991 | $6.90 | 7/16/1996 | Berlin |
| 10012 | ANATR | 4/4/1990 | $9.90 | 9/11/1996 | Madrid |
This sample demonstrates how to bind list objects to the DataGrid component for local data binding.
The Blazor DataGrid supports data binding with local collections. The DataSource property can be assigned either as a list of objects or as an instance of the DataManager component.
In this demo, a list of objects is assigned directly as the DataGrid datasource. The DataGrid supports binding to the following data source types:
- IEnumerable - Standard enumerable collections
- IQueryable - LINQ queryable collections
- ObservableCollection - Collections with automatic change notification
For more detailed information about local data binding, refer to the list binding documentation.