i also just start using this component and having lots of issue. like created Dialog in page 1 and page 2 and i have notice when ever i open dialog in Page 2 its still going to page 1 events open/close as well page 2 open/close i am not sure if Radzen dialog create only on instance per application or per page. hope i will get answer.
Now to your Question i would recommend you to use delegate function here how.
the code i am writing is only for demo purpose.
.1 create class example PlanListEvent.cs
here is code in class
public delegate void PlanListEventHandler(object source, PlanListEvent e);
public class PlanListEvent : EventArgs
{
private int PlanID;
private string Tag;
private string PlanDetail;
public PlanListEvent(int planID, string planDetail, string sender)
{
PlanID = planID;
Tag = sender;
PlanDetail = planDetail;
}
public int getPlanID()
{
return PlanID;
}
public string getTag()
{
return Tag;
}
public string getPlanDetail()
{
return PlanDetail;
}
}
now suppose you have component opened by dialog called userList.razor
in code selection
@code{
public PlanListEventHandler OnReturn;
void SelectData(int selectedID, string selectedName)
{
if (OnReturn != null)
{
OnReturn(this, new PlanListEvent(selectedID, selectedName, this.Tag));
}
}
}
now say you have button called select
<a style="color:white" class="btn btn-primary" @onclick="@(() =>SelectData(ocustomer.PlanID,ocustomer.PlanNo.ToString().Trim()))">@ocustomer.PlanID
now 3rd and final in your main page from where are you calling.
@code{
this will be in your init event
ListOfPlan.OnReturn += new PlanListEventHandler(getPlan);
void getPlan(object source, PlanListEvent e)
{
if (e.getTag() == "PlanList")
{
PageInsuranceModel.PlanID = e.getPlanID();
PageInsuranceModel.PlanInformation = e.getPlanDetail();
this.StateHasChanged();
}
}
this is called Event handling in C#
}
ListOfPlan is the instance of your component