Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“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

like image 583
ZKS Avatar asked Sep 04 '25 17:09

ZKS


2 Answers

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.

like image 142
ZKS Avatar answered Sep 07 '25 07:09

ZKS


try to type lower case "V"

@bind-Value

replace to

@bind-value
like image 31
ahmetsse Avatar answered Sep 07 '25 08:09

ahmetsse