Calling public methods on Blazor component from another component

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

What is GEEK

Buddha Community

Calling public methods on Blazor component from another component

Blazor : Calling REST API ASP NET Core Blazor | WEB API

#blazor #blazor tutorial #blazor curd #blazor in c# #blazor webassembly

Call POST API ASP NET Core Blazor | Blazor CRUD using API Part-1

#blazor #blazor tutorial #blazor curd #blazor in c# #blazor webassembly

Call GET API ASP NET Core Blazor | Blazor CRUD using API Part-2

#blazor #blazor tutorial #blazor in c# #blazor web api #blazor crud

Call DELETE API ASP NET Core Blazor | Blazor CRUD using API Part-4

#blazor #blazor tutorial #blazor crud #blazor in c# #blazor web api

Call PUT API ASP NET Core Blazor | Blazor CRUD using API Part-3

#blazor #blazor tutorial #blazor crud #blazor in c# #blazor web api