RadzenDialog redirecting when used with RadzenLink

Hi,

Please run the below code in ConfrimDialog (Blazor Dialog Component | Free UI Components by Radzen).

The dialog will open and then suddenly closes itself and navigates to home of your website.

@inject DialogService DialogService

<div class="rz-p-12 rz-text-align-center">
    <RadzenLink class="footer-container" style="cursor: pointer;" @onclick=@(args => DialogService.Confirm("Are you sure?", "MyTitle", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" }))>Terms of use. Privacy policy</RadzenLink>
</div>

Please see below gif for reference. Please let me know what is the issue and how can I fix this issue ?

RadzenDialog redirecting when used with RadzenLink

Hi @Syed_Hunain,

Links redirect by default. You should try one of the following:

  1. Use @onclick:preventDefault to stop the default action (navigating):
    <RadzenLink @onclick:preventDefault @onclick="..." />
    
  2. Use RadzenButton instead of RadzenLink. To achieve text only apperance set the Variant to Text:
    <RadzenButton Variant="Variant.Text" Click="..." />