Blazor WebAssembly: Button onclick event (async methods)

Published: 04 July 2021
on channel: Round The Code
6,050
90

We use a Blazor WebAssembly application to implement the button onclick event.

Within our Blazor Wasm app, we will create a button, and set up an onclick event by generating a call method. This will be beneficial if your onclick event is not working.

In-addition, we will demonstrate using a parameter to set up an onclick event in a child Razor component. By setting up a EventCallback type property and using the parameter attribute, we can pass an onclick event to another Razor component.

Afterwards, we will look at other Blazor events, such as onmouseover and onmouseout.

Finally, we will explore asynchronous methods. Blazor Wasm's async methods work by calling the async keyword, returning a Task type and using the await keyword to wait for a response before continuing with the method. This allows us to use the onclick event using async.

💻 Download the code example for this demo 💻
https://www.roundthecode.com/dotnet-c...

📖 Learn Blazor WebAssembly with our online courses 📖
https://www.roundthecode.com/dotnet-c...

► More information: https://www.roundthecode.com/dotnet-t...

► Chapters
0:00 What we will be looking at
0:47 Adding a button onclick event
5:24 Using a button onclick event as a parameter
8:58 Using other HTML events
12:20 Asynchronous event calls
16:35 How to download the source code


On this page of the site you can watch the video online Blazor WebAssembly: Button onclick event (async methods) with a duration of hours minute second in good quality, which was uploaded by the user Round The Code 04 July 2021, share the link with friends and acquaintances, this video has already been watched 6,050 times on youtube and it was liked by 90 viewers. Enjoy your viewing!