Compilation error when one-way binding an attribute value to a c# string.
See original GitHub issueTitle
Compilation error when one-way binding an attribute value to a c# string.
Minimal repro steps
- Create a new Blazor app
- Open Index.cshtml and add a
private string Test;
member in a@functions
code block - Add a
public string InputText {get; set;}
prop in the@functions
code block - Add the following input in the html code
<input @bind(InputText) class="@Test" />
- Try to build the project
Expected result
Code should compile
Actual result
The following error is produced
Error CS1503 Argument 2: cannot convert from 'string' to 'Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeFrame' WebApplication1.Client E:\Desktop\WebApplication1\WebApplication1\WebApplication1.Client\obj\Debug\netstandard2.0\Pages\Index.g.cs 42 Active
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Compilation error when one-way binding an attribute value ...
Compilation error when one-way binding an attribute value to a c# string. Minimal repro steps. Create a new Blazor app; Open Index.cshtml and ......
Read more >One Way to Source Binding not working
My source is my menuItem and my source property is "IsEnabled". The value converter is programmed in ConvertBack as this is the section...
Read more >Compiled bindings - .NET MAUI
To use compiled bindings, the x:DataType attribute must be set to a string literal, or a type using the x:Type markup extension.
Read more >A Detailed Look At Data Binding in Blazor
In this post, I go into detail about how data binding works in Blazor. I cover one-way binding, two-way binding and the various...
Read more >Understanding Angular property binding and interpolation
It is a one-way binding method, as values go from the component to the template layer and changes made in the component updates...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK thanks @miroslavp! Reopening.
Again I think this issue will disappear when we remove
@onclick(...)
and replace it withonclick=...
, but we should keep this issue open until we know for sure.This should be fixed in 0.2 with the new event handler feature.