Dialog component with timer

Hi there,
First of all thanks for amazing components. Im new in blazor, is there any posibility to make dialogbox with timeout ? For an example dialogbox with accept and cancel button and count down timer from 5 sec.
After count down finish i want to close dialogbox.

Hi @can_altunoz,

Yes, this is possible. You can create a timer and use the Close method of the Radzen DialogService to close the current dialog. You can search the forum for examples how to use a timer in a Blazor application.

Hi korchev ty for info but i cant find any examples or tutorials in forum :frowning: can u give me a link pls . Thanks

You can explore the search results.

Dear @korchev,
Like as you said i searched all forum links but still cant find any example...There is no countdown or timer example with any component init. Anyway ty

Yes, there isn't exactly the same thing as you need. However the links show how to use a timer. Use it as a basis of your countdown implementation.

Hey @can_altunoz,

You can do this easily like this:

                <RadzenButton Click="@((args) => OpenDialog(args))" />


                    string result;
                    Task<bool?> response;
                    void OpenDialog(object args)
                        System.Timers.Timer timer = new System.Timers.Timer();
                        timer.Interval = 3000; // 3 secs in milliseconds
                        timer.Elapsed += OnTimedEvent;
                        timer.AutoReset = false;
                        timer.Enabled = true;

                        response = DialogService.Confirm("Are you sure?", "Confirmation", new ConfirmOptions()
                            OkButtonText = "Yes",
                            CancelButtonText = "No"


                    void DoSomething()
                        // Nothing clicked
                        if (response.Result == null)
                            result = "didnt clicked anything";
                        else if (response.Result == true)
                            result = "clicked yes!";
                            result = "clicked no!";

                    private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
                        InvokeAsync(() =>

Hope it helps :wink: