In Blazor Server in .net 7 I can do this in a Page.blazor:
@message
<button class="btn btn-primary mt-2 btn-block" @onclick="SendMessage">Send Message</button>@code { public string message { get; set; } private async Task SendMessage() { message = "Hello"; }}When you click the button it outputs "Hello" on the page.
However, in .net 8 in a "Blazor Web App" (Auto, Server mixed with Web Assembly) in a Page.blazor on the server side, this button doesn't work.
Buttons in an EditForm do work but I don't want to use that, I just want clicking a button to fire an event.
Why doesn't this work in .net 8 and how can I do this?
Thanks