Using MudTextField in a blazor app returns an error : 'The attribute names could not be inferred from bind attribute 'bind-Value'.'

Viewed 125

This is the text field I am using.

<MudTextField @bind-Value="Number" Label="Outlined" Variant="Variant.Outlined"></MudTextField>

Mud is a library with components to use in Blazor. Here is text-field docs: https://mudblazor.com/components/textfield#counter

Here are my usings and imports:

@using System.Security.Claims
@using global::Serilog
@using Signumid.ESignLiteShop.Data
@using Signumid.ESignLiteShop.Data.Models
@using Signumid.ESignLiteShop.Data.Services
@using Microsoft.AspNetCore.Http
@inject IHttpContextAccessor _httpContextAccessor
@inject ShopService _shopService
@inject IJSRuntime JSRuntime;
@inject NavigationManager _navManager
@using MudBlazor

I am getting the following error: Home.razor(148, 40): [RZ9991] The attribute names could not be inferred from bind attribute 'bind-Value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.

What could be the problem here?

1 Answers

Assuming Number is an int, try this:

<MudTextField
  T="int"
  @bind-Value="Number"
  Label="Outlined" 
  Variant="Variant.Outlined"/>
Related