Blazor components are classes like any other .NET class. This means you can add public methods and call them from the parent components. For instance, if you create a dialog component, you can add a method ShowDialog
or ShowModalDialog
. In the parent component, you can call these methods to show the dialog the way you want. Another example is to add Reset
and Submit
methods to a form.
Let’s consider the following component (this is just a sample without the actual logic):
@* TODO actual html *@
<dialog></dialog>
@code {
public void Show()
{
// TODO actual implementation
}
public void ShowModal()
{
// TODO actual implementation
}
}
#blazor #.net #asp.net core #web