Radzen Alert

How to Display RadzenAlert Message dynamically?

Hi @VETRI_J,

Use the Visible property to do that:

<RadzenAlert Visible=@isVisible Text="Hi" />
<RadzenButton Click=@Toggle Text="Toggle" />
@code {
    bool isVisible = false;
    void Toggle()
    {
       isVisible = !isVisible;
}
1 Like

Thank you for your reply.
Can we use this RadzenAlert same like Notification?
Ex.

notificationService.Notify(NotificationSeverity.Warning, summary: "This Record Already Exists");

No, you can't use it like this.

1 Like

One more question?

How to get Radzen Dropdown Text Property In OnChange Event?

            <RadzenDropDown Name="RoleName" Data=@listRole Placeholder="-- Choose --" TextProperty="RoleName" ValueProperty="RoleId" @bind-Value="@((objUser.RoleId))" Change=@(args => OnChange(args)) />

void OnChange(object value)
{
}

Here value returns Value Property. But I need to get Text Property

You can check the online demo which shows various configurations (with and without setting ValueProperty).

1 Like

Hi ... I need to set both Value and Text Property. But at the same time when i select dropdown I need selected TextProperty. Guide me please...

You don't need to set ValueProperty. Just try it.

This is the solution

protected void OnChange(object value)
{
var result = listRole?.First(c => c.RoleId == Convert.ToInt32(value)).RoleName;
}

Thank you for your guidance.

Hello,

Following your example, when I close the Alert using the close button within the component, it doesn't reappear when we click the Toggle button. Can you help me with how I can work around this situation? Is the alternative to change the component's Key?