Confirmation message using Blazorise component

Step 1: Install the Blazorise nuget package and do the required configuration

Step 2: Create the Hello.razor component and write the code like this

@page "/hello"

<Button Color="Color.Primary" Clicked="@ShowInfoMessage">Say hi!</Button> <br />
<Button Color="Color.Danger" Clicked="@ShowConfirmMessage">Confirm</Button>

    [Inject] IMessageService MessageService { get; set; }

    Task ShowInfoMessage()
        return MessageService.Info( "This is a simple info message!", "Hello" );

    async Task ShowConfirmMessage()
        if ( await MessageService.Confirm( "Are you sure do you want to delete ?", "Confirmation" ) )
            Console.WriteLine( "OK Clicked" );
            Console.WriteLine( "Cancel Clicked" );

Step 3: Go to App.razor page and inject component like this

Now run the application, you will see the confirmation message like above screen shoot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.