Multi Line in DialogService.Confirm()

I want to show confirm message with multi line of text

  • i tried \n
    Envirenement.NewLine but nothings work
if( await DialogService.Confirm("confirm", "Are you sure you want to delete this mesage \n "+ Environment.NewLine +" <br /> - other eneties will removed also") == true){
// delete 
}```

The first parameter (message) supports HTML - you can add <br> to create a new line.

sorry i was wrong in the first message
It's supported only in second paramater Title but not supported in the first parameter Message

@page "/test"
@inject DialogService DialogService

<div class="rz-p-12 rz-text-align-center">
    <RadzenButton Text="Confirm dialog" ButtonStyle="ButtonStyle.Secondary" 
        Click=@(args => DialogService.Confirm("meesage first line <br /> meassage second line ", "Titre 1 <br /> titre 2")) />
</div>

image

Make sure you are using an up-to-date version. Here is what I tested with:

@inject DialogService DialogService

<div class="rz-p-12 rz-text-align-center">
    <RadzenButton Text="Confirm dialog" ButtonStyle="ButtonStyle.Secondary" 
        Click=@(args => DialogService.Confirm("Are you <br> sure?", "MyTitle", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" })) />
</div>

Hi,

Iโ€™m currently using Radzen version 6.4.0 (released on March 29, 2025) and Iโ€™ve noticed that the DialogService.Alert() and DialogService.Confirm() methods do not render HTML in the message parameter.

I tried passing a message with <br /> tags to create line breaks, but the tags are shown as plain text instead of being interpreted as HTML.

Is HTML still supported in the message parameter? If not, is there a recommended way to show multi-line messages without building a custom dialog?

Thanks!

1 Like

As for now it doesn't seem to be supported anymore.

Remove markup string by akorchev ยท Pull Request #2066 ยท radzenhq/radzen-blazor

The line responsible adding the text was changed from:

b.AddContent(i++, (MarkupString)message);

to:

b.AddContent(i++, message);

This change treats the message as plain text.

As the DialogService.Confirm() is virtual you could provide your own implementation restoring the old behavior, or simply add an extension method, which takes a MarkupString instead of string. A more advanced solution would be to implement your own dialog (incl. button handling) and open it with DialogService.OpenAsync<MyDialog>().

Indeed MarkupString support has been globally disabled. We will add new RenderFragment option that would allow using arbitrary markup.