RadzenDialog - "Cannot provide a value for property 'Service'"

Hi all. Really enjoying the Radzen components. It's making my life a heck of a lot easier!

I'm having some problems with getting the Dialog working though. I have followed all of the instructions. I've added <RadzenDialog /> to the MainLayout.razor page, injected the DialogService into the page, and am trying to use the dialog to display a warning message to the user if they fail to meet a criteria on a data entry form.

When I add the <RadzenDialog /> to MainLayout, I get the following error on trying to load:

InvalidOperationException: Cannot provide a value for property 'Service' on type 'Radzen.Blazor.RadzenDialog'. There is no registered service of type 'Radzen.DialogService'.

I'm sure it's something simple I'm missing, but I can't see it! Any help would be much appreciated!

Thanks.

Hi @Gareth_Hill,

Please add DialogService and NotificationService in Startup.ConfigureServices:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddScoped<DialogService>();
    services.AddScoped<NotificationService>();
    ...
}
1 Like

Of course! So simple!

Thanks.

I got the same error message as the original post when I tried adding HTML Editor (Blazor HTML editor componenet with lots of built-in tools).

The fix for me was to add
builder.Services.AddScoped<Radzen.DialogService>();

This is for Blazor Server.