Dialog do not understand logic

Giving example here .

Created Dialog in Page1.razor
Created Dialog in Page2.razor

when i open Dialog in Page 2 , its using Page1 Open/Close Method and also the method i created in Page2

they both injected with different name / method

I am afraid I don't understand what you mean.

i am sorry for my English. trying again
Created Page1.razor and using following code.

@inject DialogService PlanDialogService

and then in OnInitializedAsync
i am doing

PlanDialogService.OnOpen += Open;
PlanDialogService.OnClose += Close;

and here how i showing

PlanDialogService.Open<CTRLPlanList>(" Select your plan from the list ", null, new DialogOptions() { Width = "700px", Height = "530px" });

everything work good at this point.

now create Page2.razor with code.

@inject DialogService dialogPlanMain

and in init
dialogPlanMain.OnOpen += OpenPlan;
dialogPlanMain.OnClose += ClosePlan;

and here how i am showing

dialogPlanMain.Open< UserList >("Select your plan from the list ", null, new DialogOptions() { Width = "700px", Height = "530px" });

now the issue. when i close dialog which is fired from Page2 has to run ClosePlan

but its 1st running Page1 Close event then ClosePlan

same why when i open dialog in page2 its 1st running page1 Open event and then OpenPlan

The DialogService is shared in the application so it will fire active subscriptions.

the Page 1 has its own Layout from shared and Page 2 has its own , i may not get your point can you explain in little detail ?

if that has to fire in active subscription then why its firing page 1 events ?

is there any Model control in Redzen Control ?

The DialogService is shared in the application - registered in Startup.cs. You need to remove your subscriptions by implementing IDisposable in the page that uses them.

in my page1 or page 2 close event i am disposing like


with no luck

I didn't say that. Implement IDisposable in your page and unsubscribe from the OnClose/OnOpen events.

1 Like

You are the best yes now i understand you.