Skip to content

Instantly share code, notes, and snippets.

@shadow-cs
Created November 9, 2019 13:46
Show Gist options
  • Save shadow-cs/b3a39769e249f3b116c1b4f41dcb2bda to your computer and use it in GitHub Desktop.
Save shadow-cs/b3a39769e249f3b116c1b4f41dcb2bda to your computer and use it in GitHub Desktop.
Blazor Code behind
namespace CodeBehindTest.Pages
{
public partial class Counter
{
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
}
@page "/counter"
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@shadow-cs
Copy link
Author

Oh sure I did try that on 3.1 and VS Preview (just didn't have time to watch the videos fast enough), thanks for the heads up ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment