Introduction
In the previous article in this series, I analyzed whether Blazor WebAssembly is ready for enterprise production by comparing it with Angular. The conclusion was nuanced — Blazor WASM is viable for internal enterprise scenarios, but it has trade-offs that must be evaluated case by case. Today I will prove it in practice by building a full product CRUD with a paginated DataGrid, forms with validation, dialogs, notifications and inline editing — all in C#, without writing a single line of JavaScript.
The UI component library I chose is Radzen Blazor, an open source library (MIT license) with more than 70 free components. The main reason: Radzen delivers a mature visual experience for enterprise CRUD scenarios, with DataGrid, forms, validation, dialogs and notifications ready to use. The JavaScript that runs internally (Radzen.Blazor.js) belongs to the library itself — the developer never touches JS directly.
What I will build in this tutorial:
- REST API with Minimal API for Products and Categories (10 endpoints)
- Standalone Blazor WASM consuming the API via
HttpClient - Paginated DataGrid with search, ordering and per-row actions
- Reusable dialog form for creation and editing
- Inline editing for Categories (an alternative pattern to the dialog)
- Deletion with confirmation and visual notifications
All the code is in the blog-zocateli-sample repository on GitHub. The idea is that you clone it, run it and form your own opinion. This article is the 2nd in the “Frontend Moderno” series — my goal is to show that the Blazor component ecosystem already supports real production scenarios, with a development experience familiar to anyone coming from .NET.
ℹ️ Info: Radzen Blazor is open source (MIT) and includes 70+ free components.
Radzen.Blazor.jsis the library’s internal JavaScript — the developer never writes JavaScript directly. The version used in this tutorial is 10.2.0 with .NET 10.
Prerequisites
To follow this tutorial, you will need:
- .NET 10 SDK (10.0.201 or later) — official download
- IDE: VS Code with the C# Dev Kit extension, or Visual Studio 2022 17.14+
- Basic knowledge of C# and REST APIs
- A terminal (PowerShell, bash or zsh)
Clone the repository with all the code ready:
| |
Check that the SDK is installed:
| |
Expected output:
| |
💡 Tip: If you use VS Code with Dev Containers, the repository’s
.devcontainer/already has the .NET 10 SDK configured. Just open the project in the container and everything will be ready.
Creating the Standalone Blazor WASM Project
The .NET blazorwasm template creates a Standalone Blazor WebAssembly application — a SPA that runs entirely in the browser via WebAssembly, with no ASP.NET Core server hosting it. Unlike the Hosted model (which includes a Server project), Standalone is a pure SPA that consumes external APIs over HTTP, exactly like an Angular or React application.
Project scaffolding
| |
The first command creates the project, the second adds it to the solution and the third installs Radzen Blazor — the UI component library. The resulting .csproj stays lean:
| |
Configuring Program.cs
Program.cs is the SPA’s entry point. Here I configure HttpClient with the API base URL (via appsettings.json), register the typed HTTP services and add the Radzen components:
| |
The AddRadzenComponents() call automatically registers DialogService, NotificationService, TooltipService and ContextMenuService in the DI container. Without it, dialogs and notifications do not work.
Layout with Radzen
MainLayout.razor defines the application’s visual structure — a header with a sidebar toggle, side navigation with RadzenPanelMenu, a content area and a footer:
| |
The <RadzenComponents /> component at the end is mandatory — it renders the containers for dialogs, notifications and tooltips. Without it, DialogService.OpenAsync() and NotificationService.Notify() display nothing on screen.
⚠️ Warning:
<RadzenComponents />must be inside the layout, not inApp.razor. Placing it outside the layout can cause rendering problems with dialogs and notifications.
For the visual theme to work, App.razor needs to include <RadzenTheme Theme="material" />:
| |
Radzen’s material theme includes all the necessary styling — colors, typography, spacing, Material Design icons. There is no need to import Bootstrap or any other CSS framework.
The REST API — Products Domain
For Blazor WASM to consume data, I created a Products domain with Minimal API in the main project. There are 10 endpoints organized in two groups:
| Verb | Route | Description |
|---|---|---|
| GET | /api/produtos?pagina=1&tamanhoPagina=20&filtro= | List with pagination and filter |
| GET | /api/produtos/{id} | Get by ID |
| POST | /api/produtos | Create product |
| PUT | /api/produtos/{id} | Update product |
| DELETE | /api/produtos/{id} | Remove product |
| GET | /api/categorias | List all |
| GET | /api/categorias/{id} | Get by ID |
| POST | /api/categorias | Create category |
| PUT | /api/categorias/{id} | Update category |
| DELETE | /api/categorias/{id} | Remove category |
ProdutoEndpoints.cs uses MapGroup to organize the routes and ProducesResponseType to document them in Swagger:
| |
The request DTOs use DataAnnotations for server-side validation, ensuring the API validates the data even if the client side is bypassed:
| |
The service implementation uses a ConcurrentDictionary as in-memory storage (a design decision to keep the tutorial focused on Blazor WASM, with no database dependency). The initial seed includes 8 categories and more than 50 products distributed among them.
CORS configuration
Since Standalone Blazor WASM runs on a different port from the API (5200 vs 5101), it is mandatory to configure CORS in the API’s Program.cs:
| |
💡 Tip: Configuring CORS is mandatory for Standalone Blazor WASM. Without explicit configuration, the browser will block cross-origin requests. In production, replace the origins with real domains.
To test the API in isolation, run dotnet run --project src/BlogSamples and open http://localhost:5101/docs — Swagger shows all the Products and Categories endpoints.
The diagram below shows the full architecture — Blazor WASM in the browser communicates with the REST API via HttpClient (JSON) across the CORS barrier:

HTTP Services — Consuming the API
The pattern I use to consume the API is a typed service with HttpClient injected via a primary constructor. Each service encapsulates the HTTP calls for a specific domain, using the System.Net.Http.Json extension methods — GetFromJsonAsync, PostAsJsonAsync and PutAsJsonAsync:
| |
Some important points about this pattern:
Uri.EscapeDataStringon the filter prevents parameter injection in the query string. Never concatenate strings directly into URLs without encoding.EnsureSuccessStatusCode()throwsHttpRequestExceptionif the API returns an error (4xx, 5xx). In the Blazor component, I catch this exception to show an error notification to the user.- Primary constructor (
HttpClient http) avoids the field + constructor boilerplate.HttpClientis resolved by the DI container with theBaseAddressconfigured inProgram.cs.
CategoriaApiService follows exactly the same pattern, with ListarAsync, CriarAsync, AtualizarAsync and RemoverAsync methods.
In Angular, HttpClient with interceptors and RxJS operators offers similar ergonomics. In Blazor, the experience is equivalent — DelegatingHandler serves as an interceptor for authentication, logging or retry. The main difference is that Blazor uses C#’s native async/await instead of RxJS Observable.
ℹ️ Info: The Blazor WASM models are classes (not records). Radzen Blazor uses two-way binding (
@bind-Value), which requires mutable setters. Records withinitdo not work for editing in Radzen forms.
Product DataGrid with Radzen
RadzenDataGrid is the central component of this tutorial. It supports server-side pagination, sorting, filtering, custom per-column templates and direct integration with the LoadData pattern — a callback the grid calls every time it needs new data (when changing page, sorting or filtering).
Here is the complete Produtos.razor — I will explain each part:
| |
Let me detail the key points:
LoadData="@CarregarDados"— the grid calls this callback on initialization, when changing page and when sorting. It receivesLoadDataArgswithSkip,Topand ordering information. This is the key to server-side pagination.Data+Count—Datareceives the current page of items;Countreports the total number of records. The grid calculates the number of pages automatically.FormatString="{0:C2}"— formats the price as currency. Blazor WASM uses the culture configured in the browser, so in pt-BR it displays “R$ 1.299,00”.Template— custom columns. I useRadzenBadgeto display the status as a green/gray badge and action buttons (Edit, Delete) with Material Design icons.IsLoading— shows a spinner while the API is being called. It significantly improves UX on slow connections.
The @code block contains the logic:
| |
The CarregarDados method converts Skip/Top (Radzen’s pattern) to pagina/tamanhoPagina (my API’s pattern). When the user types in the search field, OnFiltroChanged goes back to the first page with grid.FirstPage(true) — the true forces the reload that calls CarregarDados again with the updated filter.
⚠️ Warning: The
RadzenDataGridLoadDataevent is called every time the grid needs data — paging, sorting, filtering. Do not confuse it with directDatabinding, which is for client-side data. If you useDatawith a complete list andAllowPaging, pagination will be client-side (all data loaded at once). WithLoadData+Count, pagination is server-side (only the current page is loaded).
Creation and Edit Form
ProdutoForm.razor is a reusable component that serves both to create and to edit products. The distinction is made by the ProdutoId Parameter: if it is null, it is creation; if it has a value, it is editing. The form is opened in a modal dialog via DialogService.OpenAsync<ProdutoForm>().
| |
Let me highlight the most important points of the form:
RadzenTemplateForm<CriarProdutoRequest>— wraps the whole form with validation. TheSubmitevent only fires if all validators pass.RadzenRequiredValidatorandRadzenNumericRangeValidator— client-side validation with automatic visual feedback (red borders, error message below the field). Server-side validation via DataAnnotations in the API is the second layer of protection.RadzenDropDown<int>for categories —Datareceives the list,TextPropertyandValuePropertymap the DTO properties.AllowFiltering="true"enables inline search in the dropdown (useful when there are many categories).RadzenSwitchwith a dynamic label — displays “Ativo” or “Inativo” according to the toggle state.- Cancel button with
ButtonType="ButtonType.Button"— without it, clicking Cancel triggers the form submit.
The @code block contains the initialization and submit logic:
| |
The complete flow is: the user clicks “Novo Produto” → DialogService.OpenAsync<ProdutoForm>() opens the dialog → the form loads the categories and, when editing, loads the product → the user fills in/edits → validators check → OnSubmit calls the API → DialogService.Close(true) closes the dialog → the grid detects resultado is true and calls grid.Reload() → data updated.
To open the dialog from Produtos.razor:
| |
The { "ProdutoId", produtoId } dictionary passes the parameter to the ProdutoForm component. DialogOptions controls the dialog width and whether it closes when clicking outside or pressing Escape.
📝 Example: Edit flow — click a product’s “Editar” button → the dialog opens with the title “Editar Produto” → fields filled with current data → change the price → click Salvar → green notification “Produto atualizado” → the grid reloads with the new price.
Deletion with Confirmation and Notifications
Every destructive operation should have a confirmation step. Radzen’s DialogService.Confirm() renders a native dialog with customizable buttons:
| |
Radzen notifications (NotificationService.Notify) appear as toasts in the corner of the screen. I use NotificationSeverity.Success with a 4-second duration for successful operations and NotificationSeverity.Error with 6 seconds for errors — more time for the user to read the message. The try/catch pattern with HttpRequestException is simple but effective: if the API returns an error (e.g. product not found), the catch shows immediate feedback to the user.
Category Management — Inline Editing
To demonstrate an alternative pattern to the dialog, the Categories screen uses inline editing — the user edits directly in the grid, without opening a modal. This approach works well for simple entities with few fields.
| |
The main difference lies in EditMode="DataGridEditMode.Single": when the user clicks “Edit”, the row enters edit mode — text fields and the switch appear in place of the static values. The buttons change from “Edit/Delete” to “Save/Cancel”.
The inline editing logic:
| |
The flow for “New Category” is: insert an empty object at position 0 of the list → grid.EditRow() puts that row in edit mode → the user fills it in → SalvarLinha calls grid.UpdateRow() → OnRowCreate fires (because Id == 0) → API called → data reloaded.
When to use inline editing vs dialog:
| Scenario | Inline Editing | Dialog |
|---|---|---|
| Simple entities (2-4 fields) | ✅ Ideal | Overkill |
| Complex entities (5+ fields, dropdowns) | Confusing | ✅ Ideal |
| Fields with elaborate validation | Limited | ✅ More visual space |
| Quick and frequent editing | ✅ Fewer clicks | More clicks |
| Mobile UX | ⚠️ Can get cramped | ✅ Better on small screens |
Tips and Good Practices
Centralize HTTP calls in typed services — never inject
HttpClientdirectly into the.razorcomponent. That violates separation of concerns and makes testing harder. Services likeProdutoApiServiceencapsulate URLs, serialization and error handling in a single reusable place.Use DataAnnotations + Radzen validators for double validation —
RadzenRequiredValidatorandRadzenNumericRangeValidatorvalidate on the client; DataAnnotations on the request DTO validate on the server. If someone bypasses the UI and calls the API directly, server-side validation still protects the data.RadzenNotification for EVERY action — consistent visual feedback on success (“Produto criado”) and error (“Não foi possível salvar”). Set different durations: 4 seconds for success, 6+ for errors (the user needs more time to read the error message).
LoadData event for server-side pagination — never load all the data on the client with a complete list. With
LoadData, only the current page is transferred over the network. For a catalog with 10,000 products, loading everything into the browser’s memory is unfeasible; with server-side pagination, each request brings only 20 records.Componentize reusable forms —
ProdutoFormserves for both creation AND editing. The distinction is a nullableParameter(int? ProdutoId). This pattern eliminates code duplication and ensures consistency between the creation and edit flows.Configure
appsettings.jsonfor the API URL — never hardcode URLs.wwwroot/appsettings.jsonin Blazor WASM works as a per-environment configuration file. In production, replace it withappsettings.Production.jsoncontaining the real API URL.Implement a loading state in the DataGrid — the
RadzenDataGridIsLoadingproperty shows a spinner while the API is called. Without visual feedback, the user does not know whether the action was triggered or the application froze. SetisLoading = truebefore the call andfalseafter.Configure AOT + Trimming for production — Blazor WASM bundle size is a real concern. For production, enable AOT compilation and trimming in the
.csproj:1 2 3 4<PropertyGroup> <RunAOTCompilation>true</RunAOTCompilation> <PublishTrimmed>true</PublishTrimmed> </PropertyGroup>AOT compiles IL to native WebAssembly (faster execution), and trimming removes unused code (smaller bundle). The trade-off is a significantly longer build time.
Conclusion
In this tutorial, I built a full CRUD with Blazor WebAssembly .NET 10 and Radzen Blazor: a DataGrid with server-side pagination and search, forms with client-side and server-side validation, modal dialogs for creation and editing, inline editing for simple entities, deletion with confirmation and visual notifications for feedback — all in C#, without the developer writing a single line of JavaScript.
Radzen Blazor delivers mature visual components for the enterprise CRUD scenario. RadzenDataGrid with LoadData solves server-side pagination elegantly. The validators (RadzenRequiredValidator, RadzenNumericRangeValidator) work well for basic validation. DialogService and NotificationService cover the complete user interaction flow.
But it is important to be transparent about the limitations I found during development:
Radzen.Blazor.jsis required — despite the “zero JavaScript” slogan, the library depends on internal JS to render complex components. It is not JavaScript written by the developer, but it is JS running in the browser.- Two-way binding requires classes, not records — Radzen’s
@bind-Valueneeds mutable setters. Records withinitdo not work for edit forms. This forces the use of classes for DTOs in Blazor WASM. - The bundle size is still significant — the .NET runtime + Radzen + the application result in a considerable initial download. AOT and trimming help, but do not solve it completely.
As I analyzed in the previous article, Blazor WASM is viable for enterprise contexts — and this tutorial shows that the component ecosystem supports real scenarios. The choice between Blazor WASM and JavaScript frameworks such as Angular or React depends on the team’s profile, SEO/SSR requirements and tolerance for bundle size, as I discussed in the comparison.
Clone the repository, run the API and Blazor WASM, and form your own opinion. The complete code is in frontend/blazor-wasm/ and src/BlogSamples/Produtos/.
Read Also
- Will Your Next Frontend Be C#? The Truth About Blazor WASM — theoretical Blazor vs Angular comparison (1st article in the “Frontend Moderno” series)
- REST API Design: HTTP Verbs and Parameter Binding — the Minimal API structure that Blazor WASM consumes in this tutorial
- Logs Without Context Are Noise: Structured Logging in .NET 8 — a mature .NET ecosystem with logging, metrics and tracing
- Authentication and Authorization: JWT, OAuth2 and OpenID Connect — next step: protecting the Blazor SPA with Entra ID
References
- Blazor WebAssembly — Official documentation — Microsoft Learn, the complete Blazor reference
- ASP.NET Core 10.0 Release Notes — what’s new in .NET 10 for the web
- Radzen Blazor Components — Get Started — setup and getting-started guide for the library
- Radzen Blazor — GitHub — source code (MIT) with examples and issues
- Radzen DataGrid — documentation and interactive demos of the central component
- blog-zocateli-sample — GitHub — repository with all the code in this article
- WebAssembly — official specification of the W3C standard
- Blazor WASM Standalone Deployment — deployment guide for production

By commenting, you agree to our Privacy Policy, Terms of Use, Data Deletion Policy.