DialogService Close All Popups

Hi, I open two popups on one page and when I call the dialogservice.close method all popups are closed. How can I prevent this or is there something I'm missing?
I use it like below


In popup

Hi @cumartesiolsun,

Make sure the close method isn't called too many times (via the debugger).

Hi @korchev, only one called in page methods but on other pages its own close method, if I opened another page before, the close method of that page is also called. (this is also valid for open method)

Indeed OnOpen and OnClose are called globally. You have to remove the event handlers at some point. Ideally you don't have to use OnClose to get the result from a dialog. It is returned when you use OpenDialogAsync.

I used dialogservice like in this example (https://blazor.radzen.com/dialog), only difference is
code on every page with add and edit button.

For example I have 5 pages and all pages have "DialogService.OnOpen + = Open;" and "DialogService.OnClose + = Close;" they have codes. If I press the add button, the add methods on all the pages I have previously opened are also called.

That's what I said. You need to unsubscribe to prevent that. Check this thread for more info: [SOLVED] Radzen Blazor server side: problem with DialogService and delegates

In most cases you shouldn't need to use OnOpen and OnClose though.

Yes it's done, thank you. I think i needed an example, thank you again
In the Dispose method "DialogService.Dispose ();" I had called but it didn't work.