<p> <input @bind="inputValue" /> </p> <p>@inputValue</p> @code { private string? inputValue; }
Equivalent HTML binding
<p> <label> Normal Blazor binding: <input @bind="InputValue" /> </label> </p> <p> <label> Demonstration of equivalent HTML binding: <input value="@InputValue" @onchange="@((ChangeEventArgs __e) => InputValue = __e?.Value?.ToString())" /> </label> </p> <p> <code>InputValue</code>: @InputValue </p> @code { private string? InputValue { get; set; } }
Bind a property or field on other Document Object Model (DOM) events
@page "/bind-event" <p> <input @bind="InputValue" @bind:event="oninput" /> </p> <p> <code>InputValue</code>: @InputValue </p> @code { private string? InputValue { get; set; } }
References
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/data-binding