In two-way binding, data moves from the component to the UI and from the UI to the component class. Use the @bind attribute in the property to bind two ways in Blazor. By default, the bind attribute binds the data in the OnChange event. The OnChange event triggers when the element loses focus.
Follow these steps to achieve the two-way binding in Blazor.
<div>
<input @bind="BindValue" @bind:event="oninput" />
</div>
<div>
Binding Value : @BindValue
</div>
@code {
public string BindValue { get; set; } = string.Empty;
}
Refer to this link for more details.
Share with