DialogService Alert and Confirm buttons text missing when no options are specified

Fix #2060
This commit is contained in:
Vladimir Enchev
2025-03-28 07:39:12 +02:00
parent 4879c49476
commit 92d69d9053

View File

@@ -457,7 +457,7 @@ namespace Radzen
public virtual async Task<bool?> Confirm(string message = "Confirm?", string title = "Confirm", ConfirmOptions options = null, CancellationToken? cancellationToken = null)
{
// Validate and set default values for the dialog options
options ??= new();
options ??= new() { OkButtonText = "Ok", CancelButtonText = "Cancel" };
options.Width = !String.IsNullOrEmpty(options.Width) ? options.Width : ""; // Width is set to 600px by default by OpenAsync
options.Style = !String.IsNullOrEmpty(options.Style) ? options.Style : "";
options.CssClass = !String.IsNullOrEmpty(options.CssClass) ? $"rz-dialog-confirm {options.CssClass}" : "rz-dialog-confirm";
@@ -504,7 +504,7 @@ namespace Radzen
public virtual async Task<bool?> Alert(string message = "", string title = "Message", AlertOptions options = null, CancellationToken? cancellationToken = null)
{
// Validate and set default values for the dialog options
options ??= new();
options ??= new() { OkButtonText = "Ok" };
options.Width = !String.IsNullOrEmpty(options.Width) ? options.Width : "";
options.Style = !String.IsNullOrEmpty(options.Style) ? options.Style : "";
options.CssClass = !String.IsNullOrEmpty(options.CssClass) ? $"rz-dialog-alert {options.CssClass}" : "rz-dialog-alert";