ZKS
ZKS

Reputation: 2816

“The attribute names could not be inferred from bind attribute 'bind-value'” exception in Blazor

While implementing custom form in Blazor I am not able to bind value to html input box.

<div class="col-sm-4">
   <input type="text" class="form-control" id="title" placeholder="Blog Title" 
   @bind-Value="blogTitle" @bind-value:event="oninput" />
</div>

@code 
{
    string blogTitle = "";
}

I am using Blazor version 3.2.0 preview version.

Any help would be appreciated. Thanks

Upvotes: 4

Views: 4541

Answers (3)

ahmetsse
ahmetsse

Reputation: 111

try to type lower case "V"

@bind-Value

replace to

@bind-value

Upvotes: 2

ZKS
ZKS

Reputation: 2816

After restarting visual studio it worked. The correct one is with "V" capital.

 @bind-Value="blogTitle"

 @bind-Value:event="oninput"

There is seems to be issue with Visual Studio 2019 preview. Whenever I add new nutget package it gives errors for missing references. I have to restart my visual studio so that newly added package takes effect. I hope updating visual studio with latest version will resolve the issue.

Upvotes: 4

PeterPazmandi
PeterPazmandi

Reputation: 581

With child components like InputDate, InputCheckbox etc use capital 'V' But for child components like textarea, label etc use lower case 'v'.

Upvotes: 0

Related Questions