This sample demonstrates how to bind a Syncfusion Blazor DataGrid to a DynamicObject
and use the EditTemplate
feature for editing fields like dropdowns dynamically.
In this example:
- The DataGrid is bound to a list of dynamic objects (
OrdersDetails
inherits fromDynamicObject
). - A custom
EditTemplate
is used to render a dropdown (SfComboBox
) in theAccount
column. - Changes made via the dropdown are captured and updated using the
RowUpdating
event. - Dynamic member access and mutation is implemented via
TryGetMember
andTrySetMember
.
- .NET 6.0 SDK or later
- Visual Studio 2022 or any IDE that supports Blazor
- Syncfusion Blazor NuGet packages
-
Clone the repository:
git clone https://github.com/SyncfusionExamples/DynamicObject-data-binding-with-EditTemplate-in-Blazor-DataGrid.git
-
Navigate to the project folder:
cd DynamicObject-data-binding-with-EditTemplate-in-Blazor-DataGrid
-
Restore the NuGet packages:
dotnet restore
-
Build and run the application:
dotnet run
-
Open the browser at https://localhost:port (port varies).