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 (
OrdersDetailsinherits fromDynamicObject). - A custom
EditTemplateis used to render a dropdown (SfComboBox) in theAccountcolumn. - Changes made via the dropdown are captured and updated using the
RowUpdatingevent. - Dynamic member access and mutation is implemented via
TryGetMemberandTrySetMember.
- .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).