Pass EventCallback parameter to component through DialogService

Trying to pass a parameter to a component, that will be opened in a dialog.

In the ProductNew component I have the parameter defined as:

[Parameter]
public EventCallback<string> OnNewProductInserted { get; set; }

How to pass the method as type object, since parameters expects type object? I understand that this probably comes down to general understanding of C# and not so much about the Radzen components. Thanks for the time.

1 Like

Here is how I solved it:

image

For all the intricacies related to EventCallback, everybody can read here: Blazor Internals: EventCallback (zhaytam.com)

2 Likes

Hello @iliyan.kulishev Could you help me? I stuck in these function.
I want to pass value from Dialog to main page.When i click Save button it 's nothing happen.

Main page

image

Child component
<RadzenButton Icon="save" Text="บันทึก" ButtonStyle="ButtonStyle.Secondary" @onclick="@(()=>SendItemListBack.InvokeAsync("test"))" />

You can just use the result returned by the dialog. It is specified by the parameter of the Close method of the dialog service

1 Like